Skip to content

Commit 25e545d

Browse files
authored
Merge pull request #186 from handrews/meta1
Standardize format of meta-schemas.
2 parents 7a5c7fc + 464abb8 commit 25e545d

File tree

3 files changed

+83
-30
lines changed

3 files changed

+83
-30
lines changed

hyper-schema.json

+30-27
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,46 @@
22
"$schema": "http://json-schema.org/draft/hyper-schema#",
33
"id": "http://json-schema.org/draft/hyper-schema#",
44
"title": "JSON Hyper-Schema",
5-
"allOf": [
6-
{"$ref": "http://json-schema.org/draft-04/schema#"}
7-
],
5+
"allOf": [ { "$ref": "http://json-schema.org/draft/schema#" } ],
86
"properties": {
97
"additionalItems": {
108
"anyOf": [
11-
{"type": "boolean"},
12-
{"$ref": "#"}
9+
{ "type": "boolean" },
10+
{ "$ref": "#" }
1311
]
1412
},
1513
"additionalProperties": {
1614
"anyOf": [
17-
{"type": "boolean"},
18-
{"$ref": "#"}
15+
{ "type": "boolean" },
16+
{ "$ref": "#" }
1917
]
2018
},
2119
"dependencies": {
2220
"additionalProperties": {
2321
"anyOf": [
24-
{"$ref": "#"},
25-
{"type": "array"}
22+
{ "$ref": "#" },
23+
{ "type": "array" }
2624
]
2725
}
2826
},
2927
"items": {
3028
"anyOf": [
31-
{"$ref": "#"},
32-
{"$ref": "#/definitions/schemaArray"}
29+
{ "$ref": "#" },
30+
{ "$ref": "#/definitions/schemaArray" }
3331
]
3432
},
3533
"definitions": {
36-
"additionalProperties": {"$ref": "#"}
34+
"additionalProperties": { "$ref": "#" }
3735
},
3836
"patternProperties": {
39-
"additionalProperties": {"$ref": "#"}
37+
"additionalProperties": { "$ref": "#" }
4038
},
4139
"properties": {
42-
"additionalProperties": {"$ref": "#"}
40+
"additionalProperties": { "$ref": "#" }
4341
},
44-
"allOf": {"$ref": "#/definitions/schemaArray"},
45-
"anyOf": {"$ref": "#/definitions/schemaArray"},
46-
"oneOf": {"$ref": "#/definitions/schemaArray"},
42+
"allOf": { "$ref": "#/definitions/schemaArray" },
43+
"anyOf": { "$ref": "#/definitions/schemaArray" },
44+
"oneOf": { "$ref": "#/definitions/schemaArray" },
4745
"not": { "$ref": "#" },
4846

4947
"base": {
@@ -52,7 +50,7 @@
5250
},
5351
"links": {
5452
"type": "array",
55-
"items": {"$ref": "#/definitions/linkDescription"}
53+
"items": { "$ref": "#/definitions/linkDescription" }
5654
},
5755
"media": {
5856
"type": "object",
@@ -66,17 +64,26 @@
6664
"type": "string"
6765
}
6866
}
67+
},
68+
"readOnly": {
69+
"description": "If true, indicates that the value of this property is controlled by the server.",
70+
"type": "boolean",
71+
"default": "false"
6972
}
7073
},
7174
"definitions": {
7275
"schemaArray": {
73-
"type": "array",
74-
"items": {"$ref": "#"}
76+
"allOf": [
77+
{ "$ref": "http://json-schema.org/drafts/schema" },
78+
{
79+
"items": { "$ref": "#" }
80+
}
81+
]
7582
},
7683
"linkDescription": {
7784
"title": "Link Description Object",
7885
"type": "object",
79-
"required": ["href"],
86+
"required": [ "href" ],
8087
"properties": {
8188
"href": {
8289
"description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",
@@ -92,7 +99,7 @@
9299
},
93100
"targetSchema": {
94101
"description": "JSON Schema describing the link target",
95-
"$ref": "#"
102+
"allOf": [ { "$ref": "#" } ]
96103
},
97104
"mediaType": {
98105
"description": "media type (as defined by RFC 2046) describing the link target",
@@ -109,7 +116,7 @@
109116
},
110117
"schema": {
111118
"description": "Schema describing the data to submit along with the request",
112-
"$ref": "#"
119+
"allOf": [ { "$ref": "#" } ]
113120
}
114121
}
115122
}
@@ -118,10 +125,6 @@
118125
{
119126
"rel": "self",
120127
"href": "{+id}"
121-
},
122-
{
123-
"rel": "full",
124-
"href": "{+($ref)}"
125128
}
126129
]
127130
}

links.json

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

schema.json

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"id": "http://json-schema.org/draft/schema#",
32
"$schema": "http://json-schema.org/draft/schema#",
4-
"description": "Core schema meta-schema",
3+
"id": "http://json-schema.org/draft/schema#",
4+
"title": "Core schema meta-schema",
55
"definitions": {
66
"schemaArray": {
77
"type": "array",
@@ -19,7 +19,15 @@
1919
]
2020
},
2121
"simpleTypes": {
22-
"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+
]
2331
},
2432
"stringArray": {
2533
"type": "array",

0 commit comments

Comments
 (0)