Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.

Draft 05 meta-schemas #57

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions draft-05/hyper-schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{
"$schema": "http://json-schema.org/draft-05/hyper-schema#",
"id": "http://json-schema.org/draft-05/hyper-schema#",
"title": "JSON Hyper-Schema",
"definitions": {
"schemaArray": {
"type": "array",
"items": { "$ref": "#/definitions/subSchema" }
},
"linkDescription": {
"title": "Link Description Object",
"type": "object",
"required": [ "href" ],
"properties": {
"href": {
"description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",
"type": "string"
},
"rel": {
"description": "relation to the target resource of the link",
"type": "string"
},
"title": {
"description": "a title for the link",
"type": "string"
},
"targetSchema": {
"description": "JSON Schema describing the link target",
"allOf": [ { "$ref": "#/definitions/subSchema" } ]
},
"mediaType": {
"description": "media type (as defined by RFC 2046) describing the link target",
"type": "string"
},
"method": {
"description": "specifies that the client can construct a templated query (\"get\") or non-idempotent request (\"post\") to a resource.",
"type": "string"
},
"encType": {
"description": "The media type in which to submit data along with the request",
"type": "string",
"default": "application/json"
},
"schema": {
"description": "Schema describing the data to submit along with the request",
"allOf": [ { "$ref": "#/definitions/subSchema" } ]
}
}
},
"subSchema": {
"oneOf": [
{
"allOf": [
{ "$ref": "#" },
{ "$ref": "http://json-schema.org/draft-05/schema#/definitions/notJsonReference" }
]
},
{ "$ref": "http://json-schema.org/draft-05/schema#/definitions/notJsonReference#/definitions/jsonReference" }
]
}
},

"allOf": [ { "$ref": "http://json-schema.org/draft-05/schema#" } ],
"properties": {
"additionalItems": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#/definitions/subSchema" }
]
},
"additionalProperties": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#/definitions/subSchema" }
]
},
"dependencies": {
"additionalProperties": {
"anyOf": [
{ "$ref": "#/definitions/subSchema" },
{ "type": "array" }
]
}
},
"items": {
"anyOf": [
{ "$ref": "#/definitions/subSchema" },
{ "$ref": "#/definitions/schemaArray" }
]
},
"definitions": {
"additionalProperties": { "$ref": "#/definitions/subSchema" }
},
"patternProperties": {
"additionalProperties": { "$ref": "#/definitions/subSchema" }
},
"properties": {
"additionalProperties": { "$ref": "#/definitions/subSchema" }
},
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#/definitions/subSchema" },

"base": {
"description": "URI Template resolved as for the 'href' keyword in the Link Description Object. The resulting URI Reference is resolved against the current URI base and sets the new URI base for URI references within the instance.",
"type": "string"
},
"links": {
"type": "array",
"items": { "$ref": "#/definitions/linkDescription" }
},
"media": {
"type": "object",
"properties": {
"type": {
"description": "A media type, as described in RFC 2046",
"type": "string"
},
"binaryEncoding": {
"description": "A content encoding scheme, as described in RFC 2045",
"type": "string"
}
}
},
"readOnly": {
"description": "If true, indicates that the value of this property is controlled by the server.",
"type": "boolean",
"default": "false"
}
},
"links": [
{
"rel": "self",
"href": "{+id}"
}
]
}
42 changes: 42 additions & 0 deletions draft-05/links
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "http://json-schema.org/draft-05/hyper-schema#",
"id": "http://json-schema.org/draft-05/links#",
"title": "Link Description Object",
"type": "object",
"required": [ "href" ],
"properties": {
"href": {
"description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",
"type": "string"
},
"rel": {
"description": "relation to the target resource of the link",
"type": "string"
},
"title": {
"description": "a title for the link",
"type": "string"
},
"targetSchema": {
"description": "JSON Schema describing the link target",
"allOf": [ { "$ref": "hyper-schema#" } ]
},
"mediaType": {
"description": "media type (as defined by RFC 2046) describing the link target",
"type": "string"
},
"method": {
"description": "specifies that the client can construct a templated query (\"get\") or non-idempotent request (\"post\") to a resource.",
"type": "string"
},
"encType": {
"description": "The media type in which to submit data along with the request",
"type": "string",
"default": "application/json"
},
"schema": {
"description": "Schema describing the data to submit along with the request",
"allOf": [ { "$ref": "hyper-schema#" } ]
}
}
}
188 changes: 188 additions & 0 deletions draft-05/schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
"$schema": "http://json-schema.org/draft-05/schema#",
"id": "http://json-schema.org/draft-05/schema#",
"title": "Core schema meta-schema",
"definitions": {
"jsonReferece": {
"type": "object",
"properties": {
"$ref": {
"type": "string",
"format": "uriref"
}
},
"required": [ "$ref" ]
},
"notJsonReference": {
"not": {
"required": [ "$ref" ]
}
},
"schemaArray": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/definitions/subSchema" }
},
"positiveInteger": {
"type": "integer",
"minimum": 0
},
"positiveIntegerDefault0": {
"allOf": [
{ "$ref": "#/definitions/positiveInteger" },
{ "default": 0 }
]
},
"simpleTypes": {
"enum": [
"array",
"boolean",
"integer",
"null",
"number",
"object",
"string"
]
},
"stringArray": {
"type": "array",
"items": { "type": "string" },
"minItems": 1,
"uniqueItems": true
},
"subSchema": {
"oneOf": [
{
"allOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/notJsonReference" }
]
},
{ "$ref": "#/definitions/jsonReference" }
]
}
},
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uriref"
},
"$schema": {
"type": "string",
"format": "uri"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"default": {},
"multipleOf": {
"type": "number",
"minimum": 0,
"exclusiveMinimum": true
},
"maximum": {
"type": "number"
},
"exclusiveMaximum": {
"type": "boolean",
"default": false
},
"minimum": {
"type": "number"
},
"exclusiveMinimum": {
"type": "boolean",
"default": false
},
"maxLength": { "$ref": "#/definitions/positiveInteger" },
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
"pattern": {
"type": "string",
"format": "regex"
},
"additionalItems": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#/definitions/subSchema" }
],
"default": {}
},
"items": {
"anyOf": [
{ "$ref": "#/definitions/subSchema" },
{ "$ref": "#/definitions/schemaArray" }
],
"default": {}
},
"maxItems": { "$ref": "#/definitions/positiveInteger" },
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
"uniqueItems": {
"type": "boolean",
"default": false
},
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" },
"additionalProperties": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#/definitions/subSchema" }
],
"default": {}
},
"definitions": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/subSchema" },
"default": {}
},
"properties": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/subSchema" },
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/subSchema" },
"default": {}
},
"dependencies": {
"type": "object",
"additionalProperties": {
"anyOf": [
{ "$ref": "#/definitions/subSchema" },
{ "$ref": "#/definitions/stringArray" }
]
}
},
"enum": {
"type": "array",
"minItems": 1,
"uniqueItems": true
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
]
},
"format": { "type": "string" },
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#/definitions/subSchema" }
},
"dependencies": {
"exclusiveMaximum": [ "maximum" ],
"exclusiveMinimum": [ "minimum" ]
},
"default": {}
}