Skip to content

Instantly share code, notes, and snippets.

@jamesfoster
Last active April 3, 2018 16:54
Show Gist options
  • Save jamesfoster/6fc47d9fd728ad710df855fb1ee4782e to your computer and use it in GitHub Desktop.
Save jamesfoster/6fc47d9fd728ad710df855fb1ee4782e to your computer and use it in GitHub Desktop.
{
"$schema": "http://bigcontent.io/cms/schema/v1/schema#",
"id": "https://gist.githubusercontent.com/jamesfoster/6fc47d9fd728ad710df855fb1ee4782e/raw/types.json",
"title": "One of each",
"description": "All supported format validations",
"type": "object",
"properties": {
"text": {
"title": "Text",
"description": "should accept any string value",
"type": "string",
"format": "text"
},
"symbol": {
"title": "Symbol",
"description": "should accept any string value",
"type": "string",
"format": "symbol"
},
"uri": {
"type": "array",
"title": "URI",
"description": "should accept RFC3986 URI",
"items": {
"type": "string",
"format": "uri"
}
},
"date-time": {
"type": "array",
"title": "Date Time",
"description": "should accept RFC3339 date-time",
"items": {
"type": "string",
"format": "date-time"
}
},
"email": {
"type": "array",
"title": "Email",
"description": "should accept RFC5322 email",
"items": {
"type": "string",
"format": "email"
}
},
"markdown": {
"type": "array",
"title": "Markdown",
"description": "should accept RFC7763 markdown",
"items": {
"type": "string",
"format": "markdown"
}
},
"enum_boolean": {
"title": "Enum of Boolean",
"description": "should accept true only",
"type": "boolean",
"enum": [
true
]
},
"enum_number": {
"title": "Enum of Number",
"description": "should accept 1, 2, 4, 8, 16",
"type": "number",
"enum": [
1,2,4,8,16
]
},
"enum_string": {
"title": "Enum of Strings",
"description": "should accept male or female",
"type": "string",
"enum": [
"male",
"female"
]
},
"string_minLength": {
"title": "String with minimum length",
"description": "should accept values at least 5 chars",
"type": "string",
"minLength": 5
},
"string_maxLength": {
"title": "String with maximum length",
"description": "should accept values no less than 10 chars",
"type": "string",
"maxLength": 10
},
"string_pattern": {
"title": "String with pattern validation",
"description": "should accept values that match the regex",
"type": "string",
"pattern": "^[Aa]"
},
"number_minimum": {
"title": "Number with minimum validation",
"description": "should accept values >= 5",
"type": "number",
"minimum": 5
},
"number_exclusive_minimum": {
"title": "Number with exclusive minimum validation",
"description": "should accept values > 5",
"type": "number",
"minimum": 5,
"exclusiveMinimum": true
},
"number_maximum": {
"title": "Number with maximum validation",
"description": "should accept values <= 5",
"type": "number",
"maximum": 5
},
"number_exclusive_maximum": {
"title": "Number with exclusive maximum validation",
"description": "should accept values < 5",
"type": "number",
"maximum": 5,
"exclusiveMaximum": true
},
"number_multipleOf": {
"title": "Number with multipleOf validation",
"description": "should accept values that are a multiple of 2",
"type": "number",
"multipleOf": 2
},
"array_minItems": {
"title": "Array with minItems validation",
"description": "should accept arrays where the number of items is gte minItems",
"type": "array",
"items": {
"type": "number"
},
"minItems": 5
},
"array_maxItems": {
"title": "Array with maxItems validation",
"description": "should accept arrays where the number of items is gte minItems",
"type": "array",
"items": {
"type": "number"
},
"maxItems": 5
},
"required": {
"type": "object",
"properties": {
"required_property": {
"type": "string"
}
},
"required": [
"required_property"
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment