Skip to content

Commit fb443dc

Browse files
committed
Simplify to avoid objects
1 parent 939a07f commit fb443dc

File tree

1 file changed

+30
-48
lines changed

1 file changed

+30
-48
lines changed

draft-ietf-httpapi-link-hint.md

Lines changed: 30 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@ In JSON-based formats, this can be achieved by simply serialising link hints as
8383
"href": "/orders/523",
8484
"hints": {
8585
"allow": ["GET", "POST"],
86-
"accept-post": {
87-
"application/example+json":
88-
{}
89-
}
86+
"accept-post": [
87+
"application/example+json"
88+
]
9089
}
9190
}
9291
}
@@ -116,52 +115,19 @@ Content MUST be an array of strings, containing HTTP methods ({{Section 9 of HTT
116115

117116
* Hint Name: formats
118117
* Description: Hints the representation type(s) that the target resource can produce and consume, using the GET and PUT (if allowed) methods respectively.
119-
* Content Model: object
120-
* Specification: \[this document]
121-
122-
Content MUST be an object, whose keys are media types ({{Section 8.3.1 of HTTP}}), and values are objects.
123-
124-
The object MAY have a "links" member, whose value is an object representing links (in the sense of {{WEB-LINKING}}) whose context is any document that uses that format. Generally, this will be schema or profile ({{?RFC6906}}) information. The "links" member has the same format as the "links" hint.
125-
126-
Furthermore, the object MAY have a "deprecated" member, whose value is either true or false, indicating whether support for the format might be removed in the near future.
127-
128-
All other members of the object are under control of the corresponding media type's definition.
129-
130-
131-
## links
132-
133-
* Hint Name: links
134-
* Description: Hints at links whose context is the target resource.
135-
* Content Model: object
118+
* Content Model: array (of strings)
136119
* Specification: \[this document]
137120

138-
The "links" hint contains links (in the sense of {{WEB-LINKING}}) whose context is the hinted target resource, which are stable for the lifetime of the hint.
139-
140-
Content MUST be an object, whose member names are link relations ({{WEB-LINKING}}) and values are objects that MUST have an "href" member whose value is a URI-reference ({{URI}}, using the original link as the base for resolution) for the link hint's target resource, and MAY itself contain link hints, serialised as the value for a "hints" member.
141-
142-
For example:
143-
144-
~~~ json
145-
"links": {
146-
"edit-form": {
147-
"href": "./edit",
148-
"hints": {
149-
"formats": {
150-
"application/json": {}
151-
}
152-
}
153-
}
154-
}
155-
~~~
121+
Content MUST be an array of strings, containing media types ({{Section 8.3.1 of HTTP}}).
156122

157123
## accept-post
158124

159125
* Hint Name: accept-post
160126
* Description: Hints the POST request format(s) that the target resource can consume.
161-
* Content Model: object
127+
* Content Model: array (of strings)
162128
* Specification: \[this document]
163129

164-
Content MUST be an object, with the same constraints as for "formats".
130+
Content MUST be an array of strings, with the same constraints as for "formats".
165131

166132
When this hint is present, "POST" SHOULD be listed in the "allow" hint.
167133

@@ -209,20 +175,36 @@ See also the 428 Precondition Required status code ({{!RFC6585}}).
209175

210176
* Hint Name: auth-schemes
211177
* Description: Hints that the target resource requires authentication using the HTTP Authentication framework {{Section 11 of HTTP}}.
212-
* Content Model: array (of objects)
178+
* Content Model: array (of strings)
213179
* Specification: \[this document]
214180

215-
Content MUST be an array of objects, each with a "scheme" member containing a string that corresponds to a HTTP authentication scheme ({{Section 11.1 of HTTP}}), and optionally a "realms" member containing an array of zero to many strings that identify protection spaces that the resource is a member of.
181+
Content MUST be an array of strings, each corresponding to a HTTP authentication scheme ({{Section 11.1 of HTTP}}), and optionally a "realms" member containing an array of zero to many strings that identify protection spaces that the resource is a member of.
216182

217183
For example:
218184

219185
~~~ json
220186
{
221-
"auth-req": [
222-
{
223-
"scheme": "Basic",
224-
"realms": ["private"]
225-
}
187+
"auth-schemes": [
188+
"Basic", "Digest"
189+
]
190+
}
191+
~~~
192+
193+
## auth-realms
194+
195+
* Hint Name: auth-realms
196+
* Description: Hints the authentication realm(s) available for those schemes that support them in the HTTP Authentication framework {{Section 11 of HTTP}}.
197+
* Content Model: array (of strings)
198+
* Specification: \[this document]
199+
200+
Content MUST be an array of strings, each indicating a protection space that the resource is a member of.
201+
202+
For example:
203+
204+
~~~ json
205+
{
206+
"auth-realms": [
207+
"private"
226208
]
227209
}
228210
~~~

0 commit comments

Comments
 (0)