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

Commit 0013e48

Browse files
committed
Standardize meta-schema formatting.
* Make the spacing / line use the same * Put $schema before the id * Use title for the short description of the whole meta-schema * Use "allOf" to combine "$ref" with "description" * Restore missing "format" and "readOnly" from Draft 04 This makes the meta-schemas correct for Draft 04 and consistently formatted (with the exception of placement of "definitions" which will be done separtely to keep the diffs clear). No Draft 05 changes have been applied at this point.
1 parent 8f39fa9 commit 0013e48

File tree

3 files changed

+43
-64
lines changed

3 files changed

+43
-64
lines changed

draft-05/hyper-schema

Lines changed: 25 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,87 +2,51 @@
22
"$schema": "http://json-schema.org/draft-04/hyper-schema#",
33
"id": "http://json-schema.org/draft-04/hyper-schema#",
44
"title": "JSON Hyper-Schema",
5-
"allOf": [
6-
{
7-
"$ref": "http://json-schema.org/draft-04/schema#"
8-
}
9-
],
5+
"allOf": [ { "$ref": "http://json-schema.org/draft-04/schema#" } ],
106
"properties": {
117
"additionalItems": {
128
"anyOf": [
13-
{
14-
"type": "boolean"
15-
},
16-
{
17-
"$ref": "#"
18-
}
9+
{ "type": "boolean" },
10+
{ "$ref": "#" }
1911
]
2012
},
2113
"additionalProperties": {
2214
"anyOf": [
23-
{
24-
"type": "boolean"
25-
},
26-
{
27-
"$ref": "#"
28-
}
15+
{ "type": "boolean" },
16+
{ "$ref": "#" }
2917
]
3018
},
3119
"dependencies": {
3220
"additionalProperties": {
3321
"anyOf": [
34-
{
35-
"$ref": "#"
36-
},
37-
{
38-
"type": "array"
39-
}
22+
{ "$ref": "#" },
23+
{ "type": "array" }
4024
]
4125
}
4226
},
4327
"items": {
4428
"anyOf": [
45-
{
46-
"$ref": "#"
47-
},
48-
{
49-
"$ref": "#/definitions/schemaArray"
50-
}
29+
{ "$ref": "#" },
30+
{ "$ref": "#/definitions/schemaArray" }
5131
]
5232
},
5333
"definitions": {
54-
"additionalProperties": {
55-
"$ref": "#"
56-
}
34+
"additionalProperties": { "$ref": "#" }
5735
},
5836
"patternProperties": {
59-
"additionalProperties": {
60-
"$ref": "#"
61-
}
37+
"additionalProperties": { "$ref": "#" }
6238
},
6339
"properties": {
64-
"additionalProperties": {
65-
"$ref": "#"
66-
}
67-
},
68-
"allOf": {
69-
"$ref": "#/definitions/schemaArray"
70-
},
71-
"anyOf": {
72-
"$ref": "#/definitions/schemaArray"
73-
},
74-
"oneOf": {
75-
"$ref": "#/definitions/schemaArray"
76-
},
77-
"not": {
78-
"$ref": "#"
40+
"additionalProperties": { "$ref": "#" }
7941
},
42+
"allOf": { "$ref": "#/definitions/schemaArray" },
43+
"anyOf": { "$ref": "#/definitions/schemaArray" },
44+
"oneOf": { "$ref": "#/definitions/schemaArray" },
45+
"not": { "$ref": "#" },
8046

8147
"links": {
8248
"type": "array",
83-
"items": {
84-
"$ref": "#/definitions/linkDescription"
85-
}
49+
"items": { "$ref": "#/definitions/linkDescription" }
8650
},
8751
"fragmentResolution": {
8852
"type": "string"
@@ -104,14 +68,17 @@
10468
"description": "Instances' URIs must start with this value for this schema to apply to them",
10569
"type": "string",
10670
"format": "uri"
71+
},
72+
"readOnly": {
73+
"description": "If true, indicates that the value of this property is controlled by the server.",
74+
"type": "boolean",
75+
"default": "false"
10776
}
10877
},
10978
"definitions": {
11079
"schemaArray": {
11180
"type": "array",
112-
"items": {
113-
"$ref": "#"
114-
}
81+
"items": { "$ref": "#" }
11582
},
11683
"linkDescription": {
11784
"title": "Link Description Object",
@@ -132,7 +99,7 @@
13299
},
133100
"targetSchema": {
134101
"description": "JSON Schema describing the link target",
135-
"$ref": "#"
102+
"allOf": [ { "$ref": "#" } ]
136103
},
137104
"mediaType": {
138105
"description": "media type (as defined by RFC 2046) describing the link target",
@@ -149,7 +116,7 @@
149116
},
150117
"schema": {
151118
"description": "Schema describing the data to submit along with the request",
152-
"$ref": "#"
119+
"allOf": [ { "$ref": "#" } ]
153120
}
154121
}
155122
}

draft-05/links

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"targetSchema": {
2121
"description": "JSON Schema describing the link target",
22-
"$ref": "hyper-schema#"
22+
"allOf": [ { "$ref": "hyper-schema#" } ]
2323
},
2424
"mediaType": {
2525
"description": "media type (as defined by RFC 2046) describing the link target",
@@ -36,7 +36,7 @@
3636
},
3737
"schema": {
3838
"description": "Schema describing the data to submit along with the request",
39-
"$ref": "hyper-schema#"
39+
"allOf": [ { "$ref": "hyper-schema#" } ]
4040
}
4141
}
4242
}

draft-05/schema

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"id": "http://json-schema.org/draft-04/schema#",
32
"$schema": "http://json-schema.org/draft-04/schema#",
4-
"description": "Core schema meta-schema",
3+
"id": "http://json-schema.org/draft-04/schema#",
4+
"title": "Core schema meta-schema",
55
"definitions": {
66
"schemaArray": {
77
"type": "array",
@@ -13,10 +13,21 @@
1313
"minimum": 0
1414
},
1515
"positiveIntegerDefault0": {
16-
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
16+
"allOf": [
17+
{ "$ref": "#/definitions/positiveInteger" },
18+
{ "default": 0 }
19+
]
1720
},
1821
"simpleTypes": {
19-
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
22+
"enum": [
23+
"array",
24+
"boolean",
25+
"integer",
26+
"null",
27+
"number",
28+
"object",
29+
"string"
30+
]
2031
},
2132
"stringArray": {
2233
"type": "array",
@@ -137,6 +148,7 @@
137148
}
138149
]
139150
},
151+
"format": { "type": "string" },
140152
"allOf": { "$ref": "#/definitions/schemaArray" },
141153
"anyOf": { "$ref": "#/definitions/schemaArray" },
142154
"oneOf": { "$ref": "#/definitions/schemaArray" },

0 commit comments

Comments
 (0)