I am using jsonschema for validating entrytypes that describe how entries (of given types) are displayed. these entries can have pages and are separated into aspects.
Both pages and aspects can be conditioned and I want to reuse a basic schema, even tho the condition on aspects can have 2 other properties that page conditions don't have.
This is a general issue that I always bump into. I want to extend a schema, while being able to have "additionalProperties" set to false in all cases.
I also dont see a possibility to fix it with anyOf, allOf without duplicates.
Or should I rather let go of additionalProperties
or accpet the duplicates?
{
"$comment": "page condition",
"type": "object",
"properties": {
"condition": {
"type": "object",
"properties": {
"aspect": {
"type": "string"
},
"value": {
"type": "string"
},
"compare": {
"type": "string"
}
},
"required": [
"aspect",
"value"
],
"additionalProperties": false
}
}
}
...
{
"$comment": "aspect condition",
"type": "object",
"properties": {
"condition": {
"type": "object",
"properties": {
"aspect": {
"type": "string"
},
"value": {
"type": "string"
},
"compare": {
"type": "string"
},
"disabled_text": {
"type": "string"
},
"default_pass": {
"type": "boolean"
}
},
"required": [
"aspect",
"value"
],
"additionalProperties": false
}
}
}