Created
December 5, 2024 14:59
-
-
Save jeremyfiel/a380f2e141ddce7193df565a4c5e840f to your computer and use it in GitHub Desktop.
json-schema.app test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"type": "object", | |
"required": [ | |
"assignments" | |
], | |
"properties": { | |
"assignments": { | |
"type": "array", | |
"items": { | |
"type": "object", | |
"properties": { | |
"type": {}, | |
"pointer": { | |
"type": "string" | |
}, | |
"completed": { | |
"type": "boolean" | |
}, | |
"chapters": { | |
"type": "array", | |
"items": { | |
"type": "object", | |
"required": [ | |
"id" | |
], | |
"properties": { | |
"id": { | |
"type": "string" | |
}, | |
"pointer": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
}, | |
"oneOf": [ | |
{ | |
"$ref": "#/definitions/multi-pointer-in-child" | |
}, | |
{ | |
"$ref": "#/definitions/multi-pointer-at-root" | |
}, | |
{ | |
"$ref": "#/definitions/notes-completed:false" | |
}, | |
{ | |
"$ref": "#/definitions/notes-completed:true" | |
} | |
] | |
} | |
} | |
}, | |
"definitions": { | |
"multi-pointer-in-child": { | |
"properties": { | |
"type": { | |
"enum": [ | |
"multi" | |
] | |
}, | |
"chapters": { | |
"minItems": 1, | |
"items": { | |
"required": [ | |
"pointer" | |
] | |
} | |
}, | |
"completed": {} | |
}, | |
"required": [ | |
"type" | |
], | |
"not": { | |
"required": [ | |
"pointer" | |
] | |
}, | |
"additionalProperties": false | |
}, | |
"multi-pointer-at-root": { | |
"properties": { | |
"type": { | |
"enum": [ | |
"multi" | |
] | |
}, | |
"pointer": {}, | |
"chapters": { | |
"items": { | |
"not": { | |
"required": [ | |
"pointer" | |
] | |
} | |
} | |
}, | |
"completed": {} | |
}, | |
"required": [ | |
"type" | |
], | |
"additionalProperties": false | |
}, | |
"notes-completed:false": { | |
"additionalProperties": false, | |
"properties": { | |
"type": { | |
"enum": [ | |
"notes" | |
] | |
}, | |
"chapters": {}, | |
"completed": { | |
"enum": [ | |
false | |
] | |
}, | |
"pointer": {} | |
}, | |
"required": [ | |
"type", | |
"pointer" | |
] | |
}, | |
"notes-completed:true": { | |
"additionalProperties": false, | |
"properties": { | |
"type": { | |
"enum": [ | |
"notes" | |
] | |
}, | |
"chapters": {}, | |
"completed": { | |
"enum": [ | |
true | |
] | |
} | |
}, | |
"required": [ | |
"type" | |
], | |
"not": { | |
"required": [ | |
"pointer" | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment