-
Notifications
You must be signed in to change notification settings - Fork 443
Open
Description
When I copy the schema which is also on the JSON schemas documentation it's not recognizing the postal_code statements to be included.
It's just converting to the following, missing the postal_code.
export type Demo = {
[k: string]: unknown;
} & {
street_address?: string;
country?: "United States of America" | "Canada" | "Netherlands";
[k: string]: unknown;
};How could we solve this issue?
{
"type": "object",
"properties": {
"street_address": {
"type": "string"
},
"country": {
"default": "United States of America",
"enum": ["United States of America", "Canada", "Netherlands"]
}
},
"allOf": [
{
"if": {
"properties": { "country": { "const": "United States of America" } }
},
"then": {
"properties": { "postal_code": { "pattern": "[0-9]{5}(-[0-9]{4})?" } }
}
},
{
"if": {
"properties": { "country": { "const": "Canada" } },
"required": ["country"]
},
"then": {
"properties": { "postal_code": { "pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]" } }
}
},
{
"if": {
"properties": { "country": { "const": "Netherlands" } },
"required": ["country"]
},
"then": {
"properties": { "postal_code": { "pattern": "[0-9]{4} [A-Z]{2}" } }
}
}
]
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels