-
-
Notifications
You must be signed in to change notification settings - Fork 213
Copy over draft-06 meta-schemas #82
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## Explanation for lack of draft-05 meta-schemas | ||
|
||
"Draft-05" in the sequential meta-schema numbering would have | ||
referred to the draft-wright-jsonschema\*-00 specifications. | ||
|
||
These specifications were intended as modernized and tidied | ||
versions of the specifications referenced by the "Draft-04" | ||
meta-schemas, so those draft-04 meta-schemas should continue | ||
to be used. | ||
|
||
"Draft-06" meta-schemas will be published for the next set of | ||
specifications. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-06/hyper-schema#", | ||
"$id": "http://json-schema.org/draft-06/hyper-schema#", | ||
"title": "JSON Hyper-Schema", | ||
"definitions": { | ||
"schemaArray": { | ||
"allOf": [ | ||
{ "$ref": "http://json-schema.org/draft-06/schema#/definitions/schemaArray" }, | ||
{ | ||
"items": { "$ref": "#" } | ||
} | ||
] | ||
}, | ||
"linkDescription": { | ||
"title": "Link Description Object", | ||
"type": "object", | ||
"required": [ "href" ], | ||
"properties": { | ||
"href": { | ||
"description": "a URI template, as defined by RFC 6570", | ||
"type": "string", | ||
"format": "uri-template" | ||
}, | ||
"hrefSchema": { | ||
"description": "a schema for validating user input to the URI template, where the input is in the form of a JSON object with property names matching variable names in \"href\"", | ||
"allOf": [ {"$ref": "#"} ] | ||
}, | ||
"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": "#" } ] | ||
}, | ||
"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": "#" } ] | ||
} | ||
} | ||
} | ||
}, | ||
"allOf": [ { "$ref": "http://json-schema.org/draft-06/schema#" } ], | ||
"properties": { | ||
"additionalItems": { | ||
"anyOf": [ | ||
{ "type": "boolean" }, | ||
{ "$ref": "#" } | ||
] | ||
}, | ||
"additionalProperties": { | ||
"anyOf": [ | ||
{ "type": "boolean" }, | ||
{ "$ref": "#" } | ||
] | ||
}, | ||
"dependencies": { | ||
"additionalProperties": { | ||
"anyOf": [ | ||
{ "$ref": "#" }, | ||
{ "type": "array" } | ||
] | ||
} | ||
}, | ||
"items": { | ||
"anyOf": [ | ||
{ "$ref": "#" }, | ||
{ "$ref": "#/definitions/schemaArray" } | ||
] | ||
}, | ||
"definitions": { | ||
"additionalProperties": { "$ref": "#" } | ||
}, | ||
"patternProperties": { | ||
"additionalProperties": { "$ref": "#" } | ||
}, | ||
"properties": { | ||
"additionalProperties": { "$ref": "#" } | ||
}, | ||
"allOf": { "$ref": "#/definitions/schemaArray" }, | ||
"anyOf": { "$ref": "#/definitions/schemaArray" }, | ||
"oneOf": { "$ref": "#/definitions/schemaArray" }, | ||
"not": { "$ref": "#" }, | ||
|
||
"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": "{+%24id}" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-06/hyper-schema#", | ||
"$id": "http://json-schema.org/draft-06/links#", | ||
"title": "Link Description Object", | ||
"type": "object", | ||
"required": [ "href" ], | ||
"properties": { | ||
"href": { | ||
"description": "a URI template, as defined by RFC 6570", | ||
"type": "string", | ||
"format": "uri-template" | ||
}, | ||
"hrefSchema": { | ||
"description": "a schema for validating user input to the URI template, where the input is in the form of a JSON object with property names matching variable names in \"href\"", | ||
"allOf": [ {"$ref": "#"} ] | ||
}, | ||
"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#" } ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question as below comment. |
||
}, | ||
"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#" } ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be schema# or hyper-schema#? I'm not sure I really understand... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hyper-schema. Requests, responses, and representations in general are hypermedia documents. Why wouldn't they be? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To my mind, if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two reasons:
But the primary answer is HATEOAS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reads up on HATEOAS. OK then. Consider me convinced. I think I've read up on HATEOAS before and not understood or just forgotten. Welcome refresh. |
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-06/schema#", | ||
"$id": "http://json-schema.org/draft-06/schema#", | ||
"title": "Core schema meta-schema", | ||
"definitions": { | ||
"schemaArray": { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { "$ref": "#" } | ||
}, | ||
"nonNegativeInteger": { | ||
"type": "integer", | ||
"minimum": 0 | ||
}, | ||
"nonNegativeIntegerDefault0": { | ||
"allOf": [ | ||
{ "$ref": "#/definitions/nonNegativeInteger" }, | ||
{ "default": 0 } | ||
] | ||
}, | ||
"simpleTypes": { | ||
"enum": [ | ||
"array", | ||
"boolean", | ||
"integer", | ||
"null", | ||
"number", | ||
"object", | ||
"string" | ||
] | ||
}, | ||
"stringArray": { | ||
"type": "array", | ||
"items": { "type": "string" }, | ||
"uniqueItems": true, | ||
"default": [] | ||
} | ||
}, | ||
"type": ["object", "boolean"], | ||
"properties": { | ||
"$id": { | ||
"type": "string", | ||
"format": "uri-reference" | ||
}, | ||
"$schema": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"$ref": { | ||
"type": "string", | ||
"format": "uri-reference" | ||
}, | ||
"title": { | ||
"type": "string" | ||
}, | ||
"description": { | ||
"type": "string" | ||
}, | ||
"default": {}, | ||
"multipleOf": { | ||
"type": "number", | ||
"exclusiveMinimum": 0 | ||
}, | ||
"maximum": { | ||
"type": "number" | ||
}, | ||
"exclusiveMaximum": { | ||
"type": "number" | ||
}, | ||
"minimum": { | ||
"type": "number" | ||
}, | ||
"exclusiveMinimum": { | ||
"type": "number" | ||
}, | ||
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, | ||
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, | ||
"pattern": { | ||
"type": "string", | ||
"format": "regex" | ||
}, | ||
"additionalItems": { "$ref": "#" }, | ||
"items": { | ||
"anyOf": [ | ||
{ "$ref": "#" }, | ||
{ "$ref": "#/definitions/schemaArray" } | ||
], | ||
"default": {} | ||
}, | ||
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, | ||
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, | ||
"uniqueItems": { | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"contains": { "$ref": "#" }, | ||
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, | ||
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, | ||
"required": { "$ref": "#/definitions/stringArray" }, | ||
"additionalProperties": { "$ref": "#" }, | ||
"definitions": { | ||
"type": "object", | ||
"additionalProperties": { "$ref": "#" }, | ||
"default": {} | ||
}, | ||
"properties": { | ||
"type": "object", | ||
"additionalProperties": { "$ref": "#" }, | ||
"default": {} | ||
}, | ||
"patternProperties": { | ||
"type": "object", | ||
"additionalProperties": { "$ref": "#" }, | ||
"default": {} | ||
}, | ||
"dependencies": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"anyOf": [ | ||
{ "$ref": "#" }, | ||
{ "$ref": "#/definitions/stringArray" } | ||
] | ||
} | ||
}, | ||
"propertyNames": { "$ref": "#" }, | ||
"const": {}, | ||
"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": "#" } | ||
}, | ||
"default": {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the $schema and $id here set as they are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the links meta-schema is itself a hyperschema (and its self link also needs to be changed from "{+id}" to "{+$id}" or however we end up dealing with that). And the links schema has its own id, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right. Yeah, with you on that now. Duh.