Last active
August 29, 2015 13:56
-
-
Save jarrodhroberson/8865779 to your computer and use it in GitHub Desktop.
JSON Schemas
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/schema#", | |
"definitions": { | |
"uuid": { | |
"title": "uuid", | |
"description": "UUID ( http://regex101.com/r/eJ7gN2 )", | |
"type": "string", | |
"minLength": 36, | |
"maxLength": 36, | |
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" | |
}, | |
"reference": { | |
"title": "reference", | |
"description": "A reference to an object by UUID", | |
"type": "object", | |
"properties" : { | |
"id": { | |
"$ref": "#/definitions/uuid" | |
} | |
}, | |
"required": [ "id" ] | |
}, | |
"image": { | |
"title": "image", | |
"description": "Reference to an image using an internal UUID", | |
"type": "object", | |
"allOf": [ { "$ref" : "#/definitions/reference"} ], | |
"properties": { | |
"size": { | |
"description": "Largest side of the image, depends on aspect ratio", | |
"type": "integer", | |
"minimum": 0, | |
"maximum": 1600 | |
}, | |
"crop": { | |
"description": "Flag to tell the system to crop the image or not", | |
"type": "boolean", | |
"default": false | |
} | |
} | |
}, | |
"text": { | |
"title": "text", | |
"description": "Text or a UUID that references to something that contains the text", | |
"type": "object", | |
"oneOf" : [ | |
{ "$ref": "#/definitions/uuid" }, | |
{ "type": "string" } | |
] | |
}, | |
} | |
} |
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/schema#", | |
"definitions": { | |
"strip": { | |
"description": "A generic notion of a Strip", | |
"type": "object", | |
"properties": { | |
"title": { | |
"description": "The title or slug text", | |
"$ref": "codex/definitions/text" | |
}, | |
"caption": { | |
"description": "The caption or tag line text", | |
"$ref": "codex/definitions/text" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is so I can refer to these schemas and test them with the schema validator at http://json-schema-validator.herokuapp.com/index.jsp