Skip to content

Instantly share code, notes, and snippets.

@mrenvoize
Created September 24, 2015 11:28
Show Gist options
  • Save mrenvoize/0c004f97e024f527a885 to your computer and use it in GitHub Desktop.
Save mrenvoize/0c004f97e024f527a885 to your computer and use it in GitHub Desktop.
JSON Schema Failure
{
"id": null,
"text": "Whatever"
}
{
"text": "Whatever"
}
Note the 'required' fields inthe schema are id + text.. however the latter json object is passing validation?
{
"$schema": "http://json-schema.org/draft-04/schema#"
"title": "rebus:list - tag",
"description": "The tag schema for rebus:list; used for creation and update of tag objects.",
"name": "tag",
"type": "object",
"properties": {
"id": {
"oneOf": [{
"type": "integer",
"multipleOf": 1
}, {
"type": "null"
}],
"title": "Id schema.",
"description": "A system generated read-only field for identifying the resource",
"name": "id"
},
"text": {
"type": "string",
"title": "Tag text",
"description": "Enter tag content here",
"name": "text",
"minLength": 1,
"pattern": "^\\S.*\\S$"
},
"list": {
"type": "integer"
}
},
"additionalProperties": false,
"required": [
"id",
"text"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment