ts-json-schema-generator
ts-json-schema-generator copied to clipboard
External reference breaks arrays
Suppose we have the following types:
fileA:
export interface ClassA {
property: string;
}
fileB:
export interface ClassB {
/**
* @ref ./ClassA.json
*/
array: ClassA[];
}
Then the output becomes:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"definitions": {},
"properties": {
"array": {
"$ref": "./ClassA.json"
},
},
"required": [
"array",
],
"type": "object"
}
Where I would expect:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"definitions": {},
"properties": {
"array": {
"items": {
"$ref": "./ClassA.json"
},
"type": "array"
},
},
"required": [
"array",
],
"type": "object"
}
Is there a way to get the right output as expected? Am I using the generator incorrectly?