Skip to content

Instantly share code, notes, and snippets.

@jarrodhroberson
Last active August 29, 2015 13:56
Show Gist options
  • Save jarrodhroberson/8865779 to your computer and use it in GitHub Desktop.
Save jarrodhroberson/8865779 to your computer and use it in GitHub Desktop.
JSON Schemas
{
"$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" }
]
},
}
}
{
"$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"
}
}
}
}
}
@jarrodhroberson
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment