Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/openapi-generator/src/knownImports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const KNOWN_IMPORTS: KnownImports = {
boolean: () => E.right({ type: 'boolean' }),
null: () => E.right({ type: 'null' }),
undefined: () => E.right({ type: 'undefined' }),
unknown: () => E.right({ type: 'any' }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cries in type-strictness 😭

Am I understanding correctly that the unknown in the LHS refers to TypeScript's unknown type, while the any on the RHS corresponds to OpenAPI's type?

If so, then I guess that's not as egregious as if both were TypeScript types!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the RHS is what eventually gets turned into an OpenAPI schema.

any: () => E.right({ type: 'any' }),
array: (_, innerSchema) => E.right({ type: 'array', items: innerSchema }),
readonlyArray: (_, innerSchema) => E.right({ type: 'array', items: innerSchema }),
type: (_, schema) => {
Expand Down Expand Up @@ -109,6 +111,7 @@ export const KNOWN_IMPORTS: KnownImports = {
});
},
brand: (_, arg) => E.right(arg),
UnknownRecord: () => E.right({ type: 'record', codomain: { type: 'any' } }),
},
'io-ts-types': {
BigIntFromString: () => E.right({ type: 'string' }),
Expand Down