bcherny/json-schema-to-typescript
View on GitHuboneOf convert to unknown after update from v9 to v10
Open
#378 opened on Mar 29, 2021
buggood first issuehelp wanted
Repository metrics
- Stars
- (3,302 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
If I use the following schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "Condition",
"properties": {
"conditions": {
"type": "object",
"additionalProperties": {
"type": "object",
"items": {
"oneOf": [
{
"$ref": "#/definitions/conditionA"
},
{
"type": "string"
}
]
}
}
}
},
"definitions": {
"conditionA": {
"title": "ConditionA",
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ConditionA"
}
},
"additionalProperties": false,
"required": ["type"]
}
},
"additionalProperties": false
}
In 9.10,
export interface Condition {
conditions?: {
[k: string]: (ConditionA | string)[]
}
}
export interface ConditionA {
type: string
}
in 10.1.0,
export interface Condition {
conditions?: {
[k: string]: {
[k: string]: unknown;
};
};
}