Skip to content

Commit 26950fe

Browse files
authored
Merge pull request #707 from bitgopatmcl/add-more-predefined-codecs
Add more predefined codecs
2 parents c2b18eb + 613a78f commit 26950fe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/openapi-generator/src/knownImports.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ export const KNOWN_IMPORTS: KnownImports = {
4848
'io-ts': {
4949
string: () => E.right({ type: 'string' }),
5050
number: () => E.right({ type: 'number' }),
51+
bigint: () => E.right({ type: 'number' }),
5152
boolean: () => E.right({ type: 'boolean' }),
5253
null: () => E.right({ type: 'null' }),
54+
nullType: () => E.right({ type: 'null' }),
5355
undefined: () => E.right({ type: 'undefined' }),
5456
unknown: () => E.right({ type: 'any' }),
5557
any: () => E.right({ type: 'any' }),
5658
array: (_, innerSchema) => E.right({ type: 'array', items: innerSchema }),
5759
readonlyArray: (_, innerSchema) => E.right({ type: 'array', items: innerSchema }),
60+
object: () => E.right({ type: 'object', properties: {}, required: [] }),
5861
type: (_, schema) => {
5962
if (schema.type !== 'object') {
6063
return E.left('typeC parameter must be object');
@@ -132,6 +135,7 @@ export const KNOWN_IMPORTS: KnownImports = {
132135
},
133136
brand: (_, arg) => E.right(arg),
134137
UnknownRecord: () => E.right({ type: 'record', codomain: { type: 'any' } }),
138+
void: () => E.right({ type: 'undefined' }),
135139
},
136140
'io-ts-types': {
137141
BigIntFromString: () => E.right({ type: 'string' }),
@@ -149,8 +153,12 @@ export const KNOWN_IMPORTS: KnownImports = {
149153
E.right({ type: 'array', items: innerSchema }),
150154
UUID: () => E.right({ type: 'string' }),
151155
Json: () => E.right({ type: 'any' }),
156+
JsonRecord: () => E.right({ type: 'record', codomain: { type: 'any' } }),
152157
withFallback: (_, schema, fallback) =>
153158
E.right({ type: 'union', schemas: [schema, fallback] }),
159+
fromNullable: (_, schema) =>
160+
E.right({ type: 'union', schemas: [schema, { type: 'null' }] }),
161+
date: () => E.right({ type: 'string', format: 'date' }),
154162
},
155163
'@api-ts/io-ts-http': {
156164
optional: (_, innerSchema) =>

0 commit comments

Comments
 (0)