Skip to content

Commit e07064c

Browse files
committed
chore: support t.strict and t.exact
1 parent f7b71ad commit e07064c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/openapi-generator/src/knownImports.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ export const KNOWN_IMPORTS: KnownImports = {
5353
}, {});
5454
return E.right({ type: 'object', properties: props, required: [] });
5555
},
56+
strict: (_, schema) => E.right(schema),
57+
exact: (_, schema) => {
58+
if (schema.type !== 'object') {
59+
return E.left('exactC parameter must be object');
60+
}
61+
const props = Object.entries(schema.properties).reduce((acc, [key, prop]) => {
62+
return { ...acc, [key]: prop };
63+
}, {});
64+
return E.right({
65+
type: 'object',
66+
properties: props,
67+
required: Object.keys(props),
68+
});
69+
},
5670
record: (_, _domain, codomain) => {
5771
if (!codomain) {
5872
return E.left('Codomain of record must be specified');

0 commit comments

Comments
 (0)