Skip to content

Commit 6d4a1b7

Browse files
committed
Change "items" field to "elements"
In the collection example, it's (probably) more confusing to have the actual collection array named the same as a JSON Schema keyword than it is to have them be asymmetric.
1 parent 9e554cc commit 6d4a1b7

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

jsonschema-hyperschema.xml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,28 +1910,23 @@ Link: <https://api.example.com/trees/1/nodes/456> rev=up
19101910
collections also often provide a way to create individual item resources with
19111911
server-assigned identifiers.
19121912
</t>
1913-
<t>
1914-
This schema describes a collection where each item representation is
1915-
identical to the individual resource item representation, and there
1916-
is enough metadata included in the collection representation to
1917-
produce pagination links. The "first" and "last" pagination links
1918-
were omitted as this is already a long example.
1919-
</t>
1920-
<t>
1921-
Note that there is an object member called "items", which is an array
1922-
and therefore uses the validation keyword "items" in its own schema.
1923-
The outer "items" is a property name, the inner one is a schema keyword.
1924-
</t>
19251913
<figure>
1914+
<preamble>
1915+
This schema describes a collection where each item representation is
1916+
identical to the individual resource item representation, and there
1917+
is enough metadata included in the collection representation to
1918+
produce pagination links. The "first" and "last" pagination links
1919+
were omitted as this is already a long example.
1920+
</preamble>
19261921
<artwork>
19271922
<![CDATA[{
19281923
"$id": "https://schema.example.com/thing-collection",
19291924
"$schema": "http://json-schema.org/draft-07-wip/hyper-schema#",
19301925
"base": "https://api.example.com",
19311926
"type": "object",
1932-
"required": ["items"],
1927+
"required": ["elements"],
19331928
"properties": {
1934-
"items": {
1929+
"elements": {
19351930
"type": "array",
19361931
"items": {
19371932
"allOf": [{"$ref": "thing#"}],
@@ -2019,7 +2014,7 @@ Link: <https://api.example.com/trees/1/nodes/456> rev=up
20192014
<figure>
20202015
<artwork>
20212016
<![CDATA[{
2022-
"items": [
2017+
"elements": [
20232018
{"id": 12345, "data": {}},
20242019
{"id": 67890, "data": {}}
20252020
],
@@ -2069,28 +2064,28 @@ Link: <https://api.example.com/trees/1/nodes/456> rev=up
20692064
"contextPointer": "",
20702065
"rel": "item",
20712066
"targetUri": "https://api.example.com/things/1234",
2072-
"attachmentPointer": "/items/0"
2067+
"attachmentPointer": "/elements/0"
20732068
},
20742069
{
20752070
"contextUri": "https://api.example.com/things",
20762071
"contextPointer": "",
20772072
"rel": "item",
20782073
"targetUri": "https://api.example.com/things/67890",
2079-
"attachmentPointer": "/items/1"
2074+
"attachmentPointer": "/elements/1"
20802075
},
20812076
{
20822077
"contextUri": "https://api.example.com/things",
2083-
"contextPointer": "/items/0",
2078+
"contextPointer": "/elements/0",
20842079
"rel": "self",
20852080
"targetUri": "https://api.example.com/things/1234",
2086-
"attachmentPointer": "/items/0"
2081+
"attachmentPointer": "/elements/0"
20872082
},
20882083
{
20892084
"contextUri": "https://api.example.com/things",
2090-
"contextPointer": "/items/1",
2085+
"contextPointer": "/elements/1",
20912086
"rel": "self",
20922087
"targetUri": "https://api.example.com/things/67890",
2093-
"attachmentPointer": "/items/1"
2088+
"attachmentPointer": "/elements/1"
20942089
}
20952090
]]]>
20962091

0 commit comments

Comments
 (0)