ts-json-schema-generator
Advanced tools
Comparing version 0.15.0 to 0.16.0
@@ -14,8 +14,3 @@ "use strict"; | ||
.map((item) => this.childTypeFormatter.getDefinition(item)); | ||
return { | ||
type: "array", | ||
items: tupleDefinitions, | ||
minItems: tupleDefinitions.length, | ||
additionalItems: { anyOf: tupleDefinitions }, | ||
}; | ||
return Object.assign({ type: "array", items: tupleDefinitions, minItems: tupleDefinitions.length }, (tupleDefinitions.length > 1 ? { additionalItems: { anyOf: tupleDefinitions } } : {})); | ||
} | ||
@@ -22,0 +17,0 @@ getChildren(type) { |
@@ -12,5 +12,6 @@ "use strict"; | ||
getDefinition(type) { | ||
return { | ||
anyOf: type.getTypes().map((item) => this.childTypeFormatter.getDefinition(item)), | ||
}; | ||
const definitions = type.getTypes().map((item) => this.childTypeFormatter.getDefinition(item)); | ||
return definitions.length > 1 ? { | ||
anyOf: definitions, | ||
} : definitions[0]; | ||
} | ||
@@ -17,0 +18,0 @@ getChildren(type) { |
{ | ||
"name": "ts-json-schema-generator", | ||
"version": "0.15.0", | ||
"version": "0.16.0", | ||
"description": "Generate JSON schema from your Typescript sources", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
11
test.ts
@@ -1,9 +0,8 @@ | ||
namespace A { | ||
export interface CC { | ||
c: number; | ||
} | ||
/** @hide */ | ||
export type Hidden = number; | ||
export interface C extends CC {} | ||
export interface A { | ||
foo: number; | ||
} | ||
export interface MyObject extends A.C {} | ||
export type MyObject = A | Hidden; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
244500
3478