-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Here's a helpful post on the capabilities in JSON schema.
Here are the cases to handle:
Is defined
a:
Data Type: "Boolean"
Required: True
b:
Data Type: "Numeric"
Required: "if a"
c:
Data Type: "Numeric"
Required: Truegives
{
"type": "object",
"properties": {
"a": { "type": "boolean" },
"b": { "type": "number" },
"c": { "type": "number" }
},
"required": ["a", "c"],
"dependencies": {
"a": ["b"]
}
}Is equal
a:
Data Type: "Boolean"
Required: True
b:
Data Type: "Numeric"
Required: "if a=False"
c:
Data Type: "Numeric"
Required: Truegives
{
"type": "object",
"properties": {
"a": { "type": "boolean" },
"b": { "type": "number" },
"c": { "type": "number" }
},
"required": ["a", "c"],
"if": {
"properties": {
"a": { "const": false}
}
},
"then": { "required": ["b"] }
}Is not equal
a:
Data Type: "Boolean"
Required: True
b:
Data Type: "Numeric"
Required: "if a!=False"
c:
Data Type: "Numeric"
Required: Truegives
{
"type": "object",
"properties": {
"a": { "type": "boolean" },
"b": { "type": "number" },
"c": { "type": "number" }
},
"required": ["a", "c"],
"if": {
"properties": {
"a": { "not": {"const": false} }
}
},
"then": { "required": ["b"] }
}We may be able to find ways to combine these too. But I think covering these cases for now should be fine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels