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

Commit e22117f

Browse files
committedNov 16, 2011
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

+5
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

+60
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

+41
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

+179
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+
}

‎draft-zyp-json-schema-04.xml

+16-78
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<!ENTITY rfc3339 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3339.xml">
99
<!ENTITY rfc2045 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2045.xml">
1010
<!ENTITY rfc5226 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5226.xml">
11-
<!ENTITY rfc2396 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2396.xml">
1211
<!ENTITY iddiscovery SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.hammer-discovery.xml">
1312
<!ENTITY uritemplate SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.gregorio-uritemplate.xml">
1413
<!ENTITY linkheader SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.nottingham-http-link-header.xml">
@@ -825,89 +824,17 @@ GET /Resource/
825824
resolving fragment identifiers in URIs within the instance
826825
representations. This applies to the instance object URIs and all
827826
children of the instance object's URIs. The default fragment resolution
828-
protocol is "slash-delimited", which is defined below. Other fragment
827+
protocol is "json-pointer", which is defined below. Other fragment
829828
resolution protocols MAY be used, but are not defined in this document.
830829
</t>
831830

832831
<t>
833-
The fragment identifier is based on <xref target="RFC2396">RFC 2396, Sec 5</xref>, and defines the
832+
The fragment identifier is based on <xref target="RFC3986">RFC 3986, Sec 5</xref>, and defines the
834833
mechanism for resolving references to entities within a document.
835834
</t>
836835

837-
<section title="slash-delimited fragment resolution">
838-
<t>
839-
With the slash-delimited fragment resolution protocol, the fragment
840-
identifier is interpreted as a series of property reference tokens that start with and
841-
are delimited by the "/" character (\x2F). Each property reference token
842-
is a series of unreserved or escaped URI characters. Each property
843-
reference token SHOULD be interpreted, starting from the beginning of
844-
the fragment identifier, as a path reference in the target JSON
845-
structure. The final target value of the fragment can be determined by
846-
starting with the root of the JSON structure from the representation of
847-
the resource identified by the pre-fragment URI. If the target is a JSON
848-
object, then the new target is the value of the property with the name
849-
identified by the next property reference token in the fragment. If the
850-
target is a JSON array, then the target is determined by finding the
851-
item in array the array with the index defined by the next property
852-
reference token (which MUST be a number). The target is successively
853-
updated for each property reference token, until the entire fragment has
854-
been traversed.
855-
</t>
856-
857-
<t>
858-
Property names SHOULD be URI-encoded. In particular, any "/" in a
859-
property name MUST be encoded to avoid being interpreted as a property
860-
delimiter.
861-
</t>
862-
863-
<t>
864-
<figure>
865-
<preamble>For example, for the following JSON representation:</preamble>
866-
<artwork>
867-
<![CDATA[
868-
{
869-
"foo": {
870-
"anArray": [{
871-
"prop": 44
872-
}],
873-
"another prop": {
874-
"baz": "A string"
875-
}
876-
}
877-
}
878-
]]>
879-
</artwork>
880-
</figure>
881-
882-
<figure>
883-
<preamble>The following fragment identifiers would be resolved:</preamble>
884-
<artwork>
885-
<![CDATA[
886-
fragment identifier resolution
887-
------------------- ----------
888-
# self, the root of the resource itself
889-
#/foo the object referred to by the foo property
890-
#/foo/another%20prop the object referred to by the "another prop"
891-
property of the object referred to by the
892-
"foo" property
893-
#/foo/another%20prop/baz the string referred to by the value of "baz"
894-
property of the "another prop" property of
895-
the object referred to by the "foo" property
896-
#/foo/anArray/0 the first object in the "anArray" array
897-
]]>
898-
</artwork>
899-
</figure>
900-
</t>
901-
</section>
902-
903-
<section title="dot-delimited fragment resolution">
904-
<t>
905-
The dot-delimited fragment resolution protocol is the same as
906-
slash-delimited fragment resolution protocol except that the "." character
907-
(\x2E) is used as the delimiter between property names (instead of "/") and
908-
the path does not need to start with a ".". For example, #.foo and #foo are a valid fragment
909-
identifiers for referencing the value of the foo propery.
910-
</t>
836+
<section title="json-pointer fragment resolution">
837+
<t>The "json-pointer" fragment resolution protocol uses a <xref target="json-pointer">JSON Pointer</xref> to resolve fragment identifiers in URIs within instance representations.</t>
911838
</section>
912839
</section>
913840

@@ -1037,10 +964,21 @@ Content-Type: application/json; profile=/schema-for-this-data
1037964
<references title="Normative References">
1038965
&rfc2045;
1039966
&rfc2119;
1040-
&rfc2396;
1041967
&rfc3339;
1042968
&rfc3986;
1043969
&rfc4287;
970+
<reference anchor="json-pointer" target="http://tools.ietf.org/html/draft-pbryan-zyp-json-pointer-02">
971+
<front>
972+
<title>JSON Pointer</title>
973+
<author initials="P." surname="Bryan">
974+
<organization>ForgeRock US, Inc.</organization>
975+
</author>
976+
<author initials="K." surname="Zyp">
977+
<organization>SitePen (USA)</organization>
978+
</author>
979+
<date year="2011" month="October" />
980+
</front>
981+
</reference>
1044982
</references>
1045983
<references title="Informative References">
1046984
&rfc2616;

0 commit comments

Comments
 (0)
This repository has been archived.