-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Consider this as a trite example:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "LoanOffer",
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": ["none", "active"]
},
"rate": { "type": "number" },
"termYears": { "type": "integer", "enum": [15, 30] },
"rateType": {
"type": "string",
"enum": ["fixed", "adjustable"]
},
"introYears": { "type": "integer", "enum": [3, 5] },
"creditScore": { "type": "integer", "minimum": 300 },
"downPayment": { "type": "number", "minimum": 0 }
},
"required": ["status"],
"allOf": [
{
"if": {
"properties": { "status": { "const": "none" } }
},
"then": {
"required": ["creditScore", "downPayment"]
}
},
{
"if": {
"properties": { "status": { "const": "active" } }
},
"then": {
"required": ["rate", "termYears", "rateType"]
}
},
{
"if": {
"properties": { "rateType": { "const": "adjustable" } }
},
"then": {
"required": ["introYears"],
"properties": {
"termYears": { "const": 30 }
}
},
"else": {
"not": { "required": ["introYears"] }
}
}
]
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request