Skip to content

Commit

Permalink
Merge pull request #87 from cyberixae/remove_broken_one_of_support
Browse files Browse the repository at this point in the history
Remove broken oneOf keyword support
  • Loading branch information
cyberixae authored Aug 23, 2023
2 parents e5d5d86 + 994f1dc commit b104757
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "io-ts-from-json-schema",
"version": "0.0.25",
"version": "0.0.26",
"description": "Iotsfjs is a static code generation utility used for converting json schema files into static TypeScript types and io-ts runtime validators.",
"license": "MIT",
"keywords": [
Expand Down
10 changes: 0 additions & 10 deletions src/iotsfjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ export type Null = t.TypeOf<typeof Null>
'additionalProperties',
'allOf',
'anyOf',
'oneOf',
'enum',
'const',
'items',
Expand Down Expand Up @@ -753,14 +752,6 @@ export type Null = t.TypeOf<typeof Null>
return [];
}

function fromOneOf(schema: JSONSchema7): [gen.TypeReference] | [] {
if ('oneOf' in schema && typeof schema.oneOf !== 'undefined') {
const combinators = schema.oneOf.map((s) => fromSchema(s));
return genUnionCombinator(combinators);
}
return [];
}

function fromSchema(schema: JSONSchema7Definition, isRoot = false): gen.TypeReference {
if (typeof schema === 'boolean') {
imps.add("import * as t from 'io-ts';");
Expand Down Expand Up @@ -797,7 +788,6 @@ export type Null = t.TypeOf<typeof Null>
...fromConst(schema),
...fromAllOf(schema),
...fromAnyOf(schema),
...fromOneOf(schema),
];
if (combinators.length > 1) {
return gen.intersectionCombinator(combinators);
Expand Down

0 comments on commit b104757

Please sign in to comment.