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

Commit e22117f

Browse files
committed
Created initial draft-04 schemas.
Added JSON Pointer to spec.
1 parent 1dd6acb commit e22117f

File tree

5 files changed

+301
-78
lines changed

5 files changed

+301
-78
lines changed

changes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* "required" is now an array, for object instances
2+
* "format" deprecated
3+
* "slash-delimited" replaced with "json-pointer"
4+
* new "minProperties" and "maxProperties"
5+
* new "template" on LDO

draft-04/hyper-schema

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"$schema" : "http://json-schema.org/draft-04/hyper-schema#",
3+
"extends" : {"$ref" : "http://json-schema.org/draft-04/schema#"},
4+
"id" : "http://json-schema.org/draft-04/hyper-schema#",
5+
6+
"properties" : {
7+
"links" : {
8+
"type" : "array",
9+
"items" : {"$ref" : "http://json-schema.org/draft-04/links#"}
10+
},
11+
12+
"fragmentResolution" : {
13+
"type" : "string",
14+
"default" : "json-pointer"
15+
},
16+
17+
"root" : {
18+
"type" : "boolean",
19+
"default" : false
20+
},
21+
22+
"readonly" : {
23+
"type" : "boolean",
24+
"default" : false
25+
},
26+
27+
"contentEncoding" : {
28+
"type" : "string"
29+
},
30+
31+
"pathStart" : {
32+
"type" : "string",
33+
"format" : "uri"
34+
},
35+
36+
"mediaType" : {
37+
"type" : "string",
38+
"format" : "media-type"
39+
}
40+
},
41+
42+
"links" : [
43+
{
44+
"href" : "{id}",
45+
"rel" : "self"
46+
},
47+
48+
{
49+
"href" : "{$ref}",
50+
"rel" : "full"
51+
},
52+
53+
{
54+
"href" : "{$schema}",
55+
"rel" : "describedby"
56+
}
57+
],
58+
59+
"fragmentResolution" : "json-pointer"
60+
}

draft-04/links

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"$schema" : "http://json-schema.org/draft-04/hyper-schema#",
3+
"id" : "http://json-schema.org/draft-04/links#",
4+
"type" : "object",
5+
6+
"properties" : {
7+
"rel" : {
8+
"type" : "string"
9+
},
10+
11+
"href" : {
12+
"type" : "string"
13+
},
14+
15+
"template" : {
16+
"type" : "string"
17+
},
18+
19+
"targetSchema" : {"$ref" : "http://json-schema.org/draft-04/hyper-schema#"},
20+
21+
"method" : {
22+
"type" : "string",
23+
"default" : "GET"
24+
},
25+
26+
"enctype" : {
27+
"type" : "string"
28+
},
29+
30+
"properties" : {
31+
"type" : "object",
32+
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-04/hyper-schema#"}
33+
}
34+
},
35+
36+
"required" : ["rel", "href"],
37+
38+
"dependencies" : {
39+
"enctype" : "method"
40+
}
41+
}

draft-04/schema

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
{
2+
"$schema" : "http://json-schema.org/draft-04/schema#",
3+
"id" : "http://json-schema.org/draft-04/schema#",
4+
"type" : "object",
5+
6+
"properties" : {
7+
"type" : {
8+
"type" : ["string", "array"],
9+
"items" : {
10+
"type" : ["string", {"$ref" : "#"}]
11+
},
12+
"uniqueItems" : true,
13+
"default" : "any"
14+
},
15+
16+
"disallow" : {
17+
"type" : ["string", "array"],
18+
"items" : {
19+
"type" : ["string", {"$ref" : "#"}]
20+
},
21+
"uniqueItems" : true
22+
},
23+
24+
"extends" : {
25+
"type" : [{"$ref" : "#"}, "array"],
26+
"items" : {"$ref" : "#"},
27+
"default" : {}
28+
},
29+
30+
"enum" : {
31+
"type" : "array",
32+
"minItems" : 1,
33+
"uniqueItems" : true
34+
},
35+
36+
"minimum" : {
37+
"type" : "number"
38+
},
39+
40+
"maximum" : {
41+
"type" : "number"
42+
},
43+
44+
"exclusiveMinimum" : {
45+
"type" : "boolean",
46+
"default" : false
47+
},
48+
49+
"exclusiveMaximum" : {
50+
"type" : "boolean",
51+
"default" : false
52+
},
53+
54+
"divisibleBy" : {
55+
"type" : "number",
56+
"minimum" : 0,
57+
"exclusiveMinimum" : true,
58+
"default" : 1
59+
},
60+
61+
"minLength" : {
62+
"type" : "integer",
63+
"minimum" : 0,
64+
"default" : 0
65+
},
66+
67+
"maxLength" : {
68+
"type" : "integer"
69+
},
70+
71+
"pattern" : {
72+
"type" : "string"
73+
},
74+
75+
"items" : {
76+
"type" : [{"$ref" : "#"}, "array"],
77+
"items" : {"$ref" : "#"},
78+
"default" : {}
79+
},
80+
81+
"additionalItems" : {
82+
"type" : [{"$ref" : "#"}, "boolean"],
83+
"default" : {}
84+
},
85+
86+
"minItems" : {
87+
"type" : "integer",
88+
"minimum" : 0,
89+
"default" : 0
90+
},
91+
92+
"maxItems" : {
93+
"type" : "integer",
94+
"minimum" : 0
95+
},
96+
97+
"uniqueItems" : {
98+
"type" : "boolean",
99+
"default" : false
100+
},
101+
102+
"properties" : {
103+
"type" : "object",
104+
"additionalProperties" : {"$ref" : "#"},
105+
"default" : {}
106+
},
107+
108+
"patternProperties" : {
109+
"type" : "object",
110+
"additionalProperties" : {"$ref" : "#"},
111+
"default" : {}
112+
},
113+
114+
"additionalProperties" : {
115+
"type" : [{"$ref" : "#"}, "boolean"],
116+
"default" : {}
117+
},
118+
119+
"minProperties" : {
120+
"type" : "integer",
121+
"minimum" : 0,
122+
"default" : 0
123+
},
124+
125+
"maxProperties" : {
126+
"type" : "integer",
127+
"minimum" : 0
128+
},
129+
130+
"required" : {
131+
"type" : "array",
132+
"items" : {
133+
"type" : "string"
134+
}
135+
},
136+
137+
"dependencies" : {
138+
"type" : "object",
139+
"additionalProperties" : {
140+
"type" : ["string", "array", {"$ref" : "#"}],
141+
"items" : {
142+
"type" : "string"
143+
}
144+
},
145+
"default" : {}
146+
},
147+
148+
"id" : {
149+
"type" : "string"
150+
},
151+
152+
"$ref" : {
153+
"type" : "string"
154+
},
155+
156+
"$schema" : {
157+
"type" : "string"
158+
},
159+
160+
"title" : {
161+
"type" : "string"
162+
},
163+
164+
"description" : {
165+
"type" : "string"
166+
},
167+
168+
"default" : {
169+
"type" : "any"
170+
}
171+
},
172+
173+
"dependencies" : {
174+
"exclusiveMinimum" : "minimum",
175+
"exclusiveMaximum" : "maximum"
176+
},
177+
178+
"default" : {}
179+
}

0 commit comments

Comments
 (0)