Skip to content

Commit b5e9cea

Browse files
committed
Copy over draft-06 meta-schemas
as decided in issue json-schema-org/json-schema-spec#165. Also add a README to explain why there's nothing in a Draft-05 directory, because people keep asking about that.
1 parent e6c2f09 commit b5e9cea

File tree

4 files changed

+344
-0
lines changed

4 files changed

+344
-0
lines changed

draft-05/README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Explanation for lack of draft-05 meta-schemas
2+
3+
"Draft-05" in the sequential meta-schema numbering would have
4+
referred to the draft-wright-jsonschema\*-00 specifications.
5+
6+
These specifications were intended as modernized and tidied
7+
versions of the specifications referenced by the "Draft-04"
8+
meta-schemas, so those draft-04 meta-schemas should continue
9+
to be used.
10+
11+
"Draft-06" meta-schemas will be published for the next set of
12+
specifications.

draft-06/hyper-schema

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-06/hyper-schema#",
3+
"$id": "http://json-schema.org/draft-06/hyper-schema#",
4+
"title": "JSON Hyper-Schema",
5+
"definitions": {
6+
"schemaArray": {
7+
"allOf": [
8+
{ "$ref": "http://json-schema.org/draft-06/schema#/definitions/schemaArray" },
9+
{
10+
"items": { "$ref": "#" }
11+
}
12+
]
13+
},
14+
"linkDescription": {
15+
"title": "Link Description Object",
16+
"type": "object",
17+
"required": [ "href" ],
18+
"properties": {
19+
"href": {
20+
"description": "a URI template, as defined by RFC 6570",
21+
"type": "string",
22+
"format": "uri-template"
23+
},
24+
"hrefSchema": {
25+
"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\"",
26+
"allOf": [ {"$ref": "#"} ]
27+
},
28+
"rel": {
29+
"description": "relation to the target resource of the link",
30+
"type": "string"
31+
},
32+
"title": {
33+
"description": "a title for the link",
34+
"type": "string"
35+
},
36+
"targetSchema": {
37+
"description": "JSON Schema describing the link target",
38+
"allOf": [ { "$ref": "#" } ]
39+
},
40+
"mediaType": {
41+
"description": "media type (as defined by RFC 2046) describing the link target",
42+
"type": "string"
43+
},
44+
"method": {
45+
"description": "specifies that the client can construct a templated query (\"get\") or non-idempotent request (\"post\") to a resource.",
46+
"type": "string"
47+
},
48+
"encType": {
49+
"description": "The media type in which to submit data along with the request",
50+
"type": "string",
51+
"default": "application/json"
52+
},
53+
"schema": {
54+
"description": "Schema describing the data to submit along with the request",
55+
"allOf": [ { "$ref": "#" } ]
56+
}
57+
}
58+
}
59+
},
60+
"allOf": [ { "$ref": "http://json-schema.org/draft-06/schema#" } ],
61+
"properties": {
62+
"additionalItems": {
63+
"anyOf": [
64+
{ "type": "boolean" },
65+
{ "$ref": "#" }
66+
]
67+
},
68+
"additionalProperties": {
69+
"anyOf": [
70+
{ "type": "boolean" },
71+
{ "$ref": "#" }
72+
]
73+
},
74+
"dependencies": {
75+
"additionalProperties": {
76+
"anyOf": [
77+
{ "$ref": "#" },
78+
{ "type": "array" }
79+
]
80+
}
81+
},
82+
"items": {
83+
"anyOf": [
84+
{ "$ref": "#" },
85+
{ "$ref": "#/definitions/schemaArray" }
86+
]
87+
},
88+
"definitions": {
89+
"additionalProperties": { "$ref": "#" }
90+
},
91+
"patternProperties": {
92+
"additionalProperties": { "$ref": "#" }
93+
},
94+
"properties": {
95+
"additionalProperties": { "$ref": "#" }
96+
},
97+
"allOf": { "$ref": "#/definitions/schemaArray" },
98+
"anyOf": { "$ref": "#/definitions/schemaArray" },
99+
"oneOf": { "$ref": "#/definitions/schemaArray" },
100+
"not": { "$ref": "#" },
101+
102+
"base": {
103+
"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.",
104+
"type": "string"
105+
},
106+
"links": {
107+
"type": "array",
108+
"items": { "$ref": "#/definitions/linkDescription" }
109+
},
110+
"media": {
111+
"type": "object",
112+
"properties": {
113+
"type": {
114+
"description": "A media type, as described in RFC 2046",
115+
"type": "string"
116+
},
117+
"binaryEncoding": {
118+
"description": "A content encoding scheme, as described in RFC 2045",
119+
"type": "string"
120+
}
121+
}
122+
},
123+
"readOnly": {
124+
"description": "If true, indicates that the value of this property is controlled by the server.",
125+
"type": "boolean",
126+
"default": "false"
127+
}
128+
},
129+
"links": [
130+
{
131+
"rel": "self",
132+
"href": "{+%24id}"
133+
}
134+
]
135+
}

draft-06/links

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-06/hyper-schema#",
3+
"$id": "http://json-schema.org/draft-06/links#",
4+
"title": "Link Description Object",
5+
"type": "object",
6+
"required": [ "href" ],
7+
"properties": {
8+
"href": {
9+
"description": "a URI template, as defined by RFC 6570",
10+
"type": "string",
11+
"format": "uri-template"
12+
},
13+
"hrefSchema": {
14+
"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\"",
15+
"allOf": [ {"$ref": "#"} ]
16+
},
17+
"rel": {
18+
"description": "relation to the target resource of the link",
19+
"type": "string"
20+
},
21+
"title": {
22+
"description": "a title for the link",
23+
"type": "string"
24+
},
25+
"targetSchema": {
26+
"description": "JSON Schema describing the link target",
27+
"allOf": [ { "$ref": "hyper-schema#" } ]
28+
},
29+
"mediaType": {
30+
"description": "media type (as defined by RFC 2046) describing the link target",
31+
"type": "string"
32+
},
33+
"method": {
34+
"description": "specifies that the client can construct a templated query (\"get\") or non-idempotent request (\"post\") to a resource.",
35+
"type": "string"
36+
},
37+
"encType": {
38+
"description": "The media type in which to submit data along with the request",
39+
"type": "string",
40+
"default": "application/json"
41+
},
42+
"schema": {
43+
"description": "Schema describing the data to submit along with the request",
44+
"allOf": [ { "$ref": "hyper-schema#" } ]
45+
}
46+
}
47+
}

draft-06/schema

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-06/schema#",
3+
"$id": "http://json-schema.org/draft-06/schema#",
4+
"title": "Core schema meta-schema",
5+
"definitions": {
6+
"schemaArray": {
7+
"type": "array",
8+
"minItems": 1,
9+
"items": { "$ref": "#" }
10+
},
11+
"nonNegativeInteger": {
12+
"type": "integer",
13+
"minimum": 0
14+
},
15+
"nonNegativeIntegerDefault0": {
16+
"allOf": [
17+
{ "$ref": "#/definitions/nonNegativeInteger" },
18+
{ "default": 0 }
19+
]
20+
},
21+
"simpleTypes": {
22+
"enum": [
23+
"array",
24+
"boolean",
25+
"integer",
26+
"null",
27+
"number",
28+
"object",
29+
"string"
30+
]
31+
},
32+
"stringArray": {
33+
"type": "array",
34+
"items": { "type": "string" },
35+
"uniqueItems": true,
36+
"default": []
37+
}
38+
},
39+
"type": ["object", "boolean"],
40+
"properties": {
41+
"$id": {
42+
"type": "string",
43+
"format": "uri-reference"
44+
},
45+
"$schema": {
46+
"type": "string",
47+
"format": "uri"
48+
},
49+
"$ref": {
50+
"type": "string",
51+
"format": "uri-reference"
52+
},
53+
"title": {
54+
"type": "string"
55+
},
56+
"description": {
57+
"type": "string"
58+
},
59+
"default": {},
60+
"multipleOf": {
61+
"type": "number",
62+
"exclusiveMinimum": 0
63+
},
64+
"maximum": {
65+
"type": "number"
66+
},
67+
"exclusiveMaximum": {
68+
"type": "number"
69+
},
70+
"minimum": {
71+
"type": "number"
72+
},
73+
"exclusiveMinimum": {
74+
"type": "number"
75+
},
76+
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
77+
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
78+
"pattern": {
79+
"type": "string",
80+
"format": "regex"
81+
},
82+
"additionalItems": { "$ref": "#" },
83+
"items": {
84+
"anyOf": [
85+
{ "$ref": "#" },
86+
{ "$ref": "#/definitions/schemaArray" }
87+
],
88+
"default": {}
89+
},
90+
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
91+
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
92+
"uniqueItems": {
93+
"type": "boolean",
94+
"default": false
95+
},
96+
"contains": { "$ref": "#" },
97+
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
98+
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
99+
"required": { "$ref": "#/definitions/stringArray" },
100+
"additionalProperties": { "$ref": "#" },
101+
"definitions": {
102+
"type": "object",
103+
"additionalProperties": { "$ref": "#" },
104+
"default": {}
105+
},
106+
"properties": {
107+
"type": "object",
108+
"additionalProperties": { "$ref": "#" },
109+
"default": {}
110+
},
111+
"patternProperties": {
112+
"type": "object",
113+
"additionalProperties": { "$ref": "#" },
114+
"default": {}
115+
},
116+
"dependencies": {
117+
"type": "object",
118+
"additionalProperties": {
119+
"anyOf": [
120+
{ "$ref": "#" },
121+
{ "$ref": "#/definitions/stringArray" }
122+
]
123+
}
124+
},
125+
"propertyNames": { "$ref": "#" },
126+
"const": {},
127+
"enum": {
128+
"type": "array",
129+
"minItems": 1,
130+
"uniqueItems": true
131+
},
132+
"type": {
133+
"anyOf": [
134+
{ "$ref": "#/definitions/simpleTypes" },
135+
{
136+
"type": "array",
137+
"items": { "$ref": "#/definitions/simpleTypes" },
138+
"minItems": 1,
139+
"uniqueItems": true
140+
}
141+
]
142+
},
143+
"format": { "type": "string" },
144+
"allOf": { "$ref": "#/definitions/schemaArray" },
145+
"anyOf": { "$ref": "#/definitions/schemaArray" },
146+
"oneOf": { "$ref": "#/definitions/schemaArray" },
147+
"not": { "$ref": "#" }
148+
},
149+
"default": {}
150+
}

0 commit comments

Comments
 (0)