quicktype
quicktype copied to clipboard
JSONSchema: "OneOf" in "Array.Items" is ignored
Given the following json-schema:
{
"$id": "https://json-schema.hyperjump.io/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"items": {
"oneOf": [
{"type": "object", "additionalProperties": false, "properties": { "aa": { "type": "string" }, "bb": { "type": "string" }}},
{"type": "object", "additionalProperties": false, "properties": { "cc": { "type": "string" }, "dd": { "type": "string" }}}
]
}
}
Quicktype generates the following incorrect types:
export interface PurpleArray {
aa?: string;
bb?: string;
cc?: string;
dd?: string;
}
According to the json-schema spec, this is valid:
[
{"aa": "aa", "bb":"bb"},
{"cc": "cc", "dd":"dd"}
]
But this one is not:
[
{"aa": "aa", "bb":"bb"},
{"aa": "aa", "cc": "cc", "dd":"dd"}
]