Skip to content

Commit 43baaa2

Browse files
committed
fix: problem with using anyOf
1 parent 01cd93a commit 43baaa2

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# next release
22

3+
fix: problem with using `anyOf`
4+
35
## 13.0.0
46

57
BREAKING_CHANGE: disable support NodeJS 14.x

src/schema-parser/complex-schema-parsers/any-of.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { MonoSchemaParser } = require('../mono-schema-parser');
22
const _ = require('lodash');
33

4-
// T1 | T2 | (T1 & T2)
4+
// T1 | T2
55
class AnyOfSchemaParser extends MonoSchemaParser {
66
parse() {
77
const ignoreTypes = [this.config.Ts.Keyword.Any];
@@ -12,20 +12,13 @@ class AnyOfSchemaParser extends MonoSchemaParser {
1212
this.schemaPath,
1313
),
1414
);
15+
1516
const filtered = this.schemaUtils.filterSchemaContents(
1617
combined,
1718
(content) => !ignoreTypes.includes(content),
1819
);
1920

20-
const type = this.config.Ts.UnionType(
21-
_.compact([
22-
...filtered,
23-
filtered.length > 1 &&
24-
this.config.Ts.ExpressionGroup(
25-
this.config.Ts.IntersectionType(filtered),
26-
),
27-
]),
28-
);
21+
const type = this.config.Ts.UnionType(filtered);
2922

3023
return this.schemaUtils.safeAddNullToType(this.schema, type);
3124
}

0 commit comments

Comments
 (0)