Skip to content

Instantly share code, notes, and snippets.

@freetonik
Created August 4, 2014 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freetonik/daa3220720ecf0e7da6d to your computer and use it in GitHub Desktop.
Save freetonik/daa3220720ecf0e7da6d to your computer and use it in GitHub Desktop.
{
"id": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Quiz schema",
"type": "object",
"properties": {
"items": {
"type": "object",
"patternProperties": {
"[A-Za-z0-9_-]" : {
"oneOf" : [
{
"type": "object",
"required": ["question", "correct_answers", "answers"],
"properties": {
"question": {
"type": "string"
},
"correct_answers": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
},
"uniqueItems": true
},
"answers": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
},
"uniqueItems": true
}
}
},
{
"type": "object",
"required": ["question", "correct_answers", "text"],
"properties": {
"question": {
"type": "string"
},
"text": {
"type": "string",
"pattern": "(.*{[\\w_]+})+"
},
"correct_answers": {
"type": "object",
"patternProperties": {
"[A-Za-z0-9_-]" : {
"type": "string"
}
}
}
}
}
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment