Skip to content

Commit 33bb0ba

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 d163932 commit 33bb0ba

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
@@ -1916,28 +1916,23 @@ Link: <https://api.example.com/trees/1/nodes/456> rev=up
19161916
collections also often provide a way to create individual item resources with
19171917
server-assigned identifiers.
19181918
</t>
1919-
<t>
1920-
This schema describes a collection where each item representation is
1921-
identical to the individual resource item representation, and there
1922-
is enough metadata included in the collection representation to
1923-
produce pagination links. The "first" and "last" pagination links
1924-
were omitted as this is already a long example.
1925-
</t>
1926-
<t>
1927-
Note that there is an object member called "items", which is an array
1928-
and therefore uses the validation keyword "items" in its own schema.
1929-
The outer "items" is a property name, the inner one is a schema keyword.
1930-
</t>
19311919
<figure>
1920+
<preamble>
1921+
This schema describes a collection where each item representation is
1922+
identical to the individual resource item representation, and there
1923+
is enough metadata included in the collection representation to
1924+
produce pagination links. The "first" and "last" pagination links
1925+
were omitted as this is already a long example.
1926+
</preamble>
19321927
<artwork>
19331928
<![CDATA[{
19341929
"$id": "https://schema.example.com/thing-collection",
19351930
"$schema": "http://json-schema.org/draft-07-wip/hyper-schema#",
19361931
"base": "https://api.example.com",
19371932
"type": "object",
1938-
"required": ["items"],
1933+
"required": ["elements"],
19391934
"properties": {
1940-
"items": {
1935+
"elements": {
19411936
"type": "array",
19421937
"items": {
19431938
"allOf": [{"$ref": "thing#"}],
@@ -2025,7 +2020,7 @@ Link: <https://api.example.com/trees/1/nodes/456> rev=up
20252020
<figure>
20262021
<artwork>
20272022
<![CDATA[{
2028-
"items": [
2023+
"elements": [
20292024
{"id": 12345, "data": {}},
20302025
{"id": 67890, "data": {}}
20312026
],
@@ -2075,28 +2070,28 @@ Link: <https://api.example.com/trees/1/nodes/456> rev=up
20752070
"contextPointer": "",
20762071
"rel": "item",
20772072
"targetUri": "https://api.example.com/things/1234",
2078-
"attachmentPointer": "/items/0"
2073+
"attachmentPointer": "/elements/0"
20792074
},
20802075
{
20812076
"contextUri": "https://api.example.com/things",
20822077
"contextPointer": "",
20832078
"rel": "item",
20842079
"targetUri": "https://api.example.com/things/67890",
2085-
"attachmentPointer": "/items/1"
2080+
"attachmentPointer": "/elements/1"
20862081
},
20872082
{
20882083
"contextUri": "https://api.example.com/things",
2089-
"contextPointer": "/items/0",
2084+
"contextPointer": "/elements/0",
20902085
"rel": "self",
20912086
"targetUri": "https://api.example.com/things/1234",
2092-
"attachmentPointer": "/items/0"
2087+
"attachmentPointer": "/elements/0"
20932088
},
20942089
{
20952090
"contextUri": "https://api.example.com/things",
2096-
"contextPointer": "/items/1",
2091+
"contextPointer": "/elements/1",
20972092
"rel": "self",
20982093
"targetUri": "https://api.example.com/things/67890",
2099-
"attachmentPointer": "/items/1"
2094+
"attachmentPointer": "/elements/1"
21002095
}
21012096
]]]>
21022097

0 commit comments

Comments
 (0)