codecombat/app/schemas/metaschema.coffee

133 lines
3.4 KiB
CoffeeScript
Raw Permalink Normal View History

2014-04-12 04:35:56 -04:00
# The JSON Schema Core/Validation Meta-Schema, but with titles and descriptions added to make it easier to edit in Treema, and in CoffeeScript
module.exports =
2014-06-30 22:16:26 -04:00
id: 'metaschema'
displayProperty: 'title'
$schema: 'http://json-schema.org/draft-04/schema#'
title: 'Schema'
description: 'Core schema meta-schema'
2014-04-12 04:35:56 -04:00
definitions:
schemaArray:
2014-06-30 22:16:26 -04:00
type: 'array'
2014-04-12 04:35:56 -04:00
minItems: 1
2014-06-30 22:16:26 -04:00
items: {$ref: '#'}
title: 'Array of Schemas'
'default': [{}]
2014-04-12 04:35:56 -04:00
positiveInteger:
2014-06-30 22:16:26 -04:00
type: 'integer'
2014-04-12 04:35:56 -04:00
minimum: 0
2014-06-30 22:16:26 -04:00
title: 'Positive Integer'
2014-04-12 04:35:56 -04:00
positiveIntegerDefault0:
2014-06-30 22:16:26 -04:00
allOf: [{$ref: '#/definitions/positiveInteger'}, {'default': 0}]
2014-04-12 04:35:56 -04:00
simpleTypes:
2014-06-30 22:16:26 -04:00
title: 'Single Type'
'enum': ['array', 'boolean', 'integer', 'null', 'number', 'object', 'string']
2014-04-12 04:35:56 -04:00
stringArray:
2014-06-30 22:16:26 -04:00
type: 'array'
items: {type: 'string'}
2014-04-12 04:35:56 -04:00
minItems: 1
uniqueItems: true
2014-06-30 22:16:26 -04:00
title: 'String Array'
'default': ['']
type: 'object'
2014-04-12 04:35:56 -04:00
properties:
id:
2014-06-30 22:16:26 -04:00
type: 'string'
format: 'uri'
2014-04-12 04:35:56 -04:00
$schema:
2014-06-30 22:16:26 -04:00
type: 'string'
format: 'uri'
'default': 'http://json-schema.org/draft-04/schema#'
2014-04-12 04:35:56 -04:00
title:
2014-06-30 22:16:26 -04:00
type: 'string'
2014-04-12 04:35:56 -04:00
description:
2014-06-30 22:16:26 -04:00
type: 'string'
'default': {}
2014-04-12 04:35:56 -04:00
multipleOf:
2014-06-30 22:16:26 -04:00
type: 'number'
2014-04-12 04:35:56 -04:00
minimum: 0
exclusiveMinimum: true
maximum:
2014-06-30 22:16:26 -04:00
type: 'number'
2014-04-12 04:35:56 -04:00
exclusiveMaximum:
2014-06-30 22:16:26 -04:00
type: 'boolean'
'default': false
2014-04-12 04:35:56 -04:00
minimum:
2014-06-30 22:16:26 -04:00
type: 'number'
2014-04-12 04:35:56 -04:00
exclusiveMinimum:
2014-06-30 22:16:26 -04:00
type: 'boolean'
'default': false
maxLength: {$ref: '#/definitions/positiveInteger'}
minLength: {$ref: '#/definitions/positiveIntegerDefault0'}
2014-04-12 04:35:56 -04:00
pattern:
2014-06-30 22:16:26 -04:00
type: 'string'
format: 'regex'
2014-04-12 04:35:56 -04:00
additionalItems:
anyOf: [
2014-06-30 22:16:26 -04:00
{type: 'boolean', 'default': false}
{$ref: '#'}
2014-04-12 04:35:56 -04:00
]
items:
anyOf: [
2014-06-30 22:16:26 -04:00
{$ref: '#'}
{$ref: '#/definitions/schemaArray'}
2014-04-12 04:35:56 -04:00
]
2014-06-30 22:16:26 -04:00
'default': {}
maxItems: {$ref: '#/definitions/positiveInteger'}
minItems: {$ref: '#/definitions/positiveIntegerDefault0'}
2014-04-12 04:35:56 -04:00
uniqueItems:
2014-06-30 22:16:26 -04:00
type: 'boolean'
'default': false
maxProperties: {$ref: '#/definitions/positiveInteger'}
minProperties: {$ref: '#/definitions/positiveIntegerDefault0'}
required: {$ref: '#/definitions/stringArray'}
2014-04-12 04:35:56 -04:00
additionalProperties:
anyOf: [
2014-06-30 22:16:26 -04:00
{type: 'boolean', 'default': true}
{$ref: '#'}
2014-04-12 04:35:56 -04:00
]
2014-06-30 22:16:26 -04:00
'default': {}
2014-04-12 04:35:56 -04:00
definitions:
2014-06-30 22:16:26 -04:00
type: 'object'
additionalProperties: {$ref: '#'}
'default': {}
2014-04-12 04:35:56 -04:00
properties:
2014-06-30 22:16:26 -04:00
type: 'object'
additionalProperties: {$ref: '#'}
'default': {}
2014-04-12 04:35:56 -04:00
patternProperties:
2014-06-30 22:16:26 -04:00
type: 'object'
additionalProperties: {$ref: '#'}
'default': {}
2014-04-12 04:35:56 -04:00
dependencies:
2014-06-30 22:16:26 -04:00
type: 'object'
2014-04-12 04:35:56 -04:00
additionalProperties:
anyOf: [
2014-06-30 22:16:26 -04:00
{$ref: '#'}
{$ref: '#/definitions/stringArray'}
2014-04-12 04:35:56 -04:00
]
2014-06-30 22:16:26 -04:00
'enum':
type: 'array'
2014-04-12 04:35:56 -04:00
minItems: 1
uniqueItems: true
2014-06-30 22:16:26 -04:00
'default': ['']
2014-04-12 04:35:56 -04:00
type:
anyOf: [
2014-06-30 22:16:26 -04:00
{$ref: '#/definitions/simpleTypes'}
2014-04-12 04:35:56 -04:00
{
2014-06-30 22:16:26 -04:00
type: 'array'
items: {$ref: '#/definitions/simpleTypes'}
2014-04-12 04:35:56 -04:00
minItems: 1
uniqueItems: true
2014-06-30 22:16:26 -04:00
title: 'Array of Types'
'default': ['string']
2014-04-12 04:35:56 -04:00
}]
2014-06-30 22:16:26 -04:00
allOf: {$ref: '#/definitions/schemaArray'}
anyOf: {$ref: '#/definitions/schemaArray'}
oneOf: {$ref: '#/definitions/schemaArray'}
not: {$ref: '#'}
2014-04-12 04:35:56 -04:00
dependencies:
2014-06-30 22:16:26 -04:00
exclusiveMaximum: ['maximum']
exclusiveMinimum: ['minimum']
'default': {}