Skip to content

Commit fd19e5c

Browse files
authored
Merge pull request #476 from handrews/http
Rework '"targetSchema" and HTTP'
2 parents 92d3774 + 8af5d93 commit fd19e5c

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

jsonschema-hyperschema.xml

+24-15
Original file line numberDiff line numberDiff line change
@@ -1333,29 +1333,38 @@ for varname in templateData:
13331333
</section>
13341334
<section title='"targetSchema" and HTTP' anchor="targetHTTP">
13351335
<t>
1336-
The relationship between a resource's representation and HTTP requests and
1337-
responses is determined by <xref target="RFC7231">RFC 7231, section 4.3.1 -
1338-
"GET", section 4.3.4 "PUT", and section 3.1.4.2, "Content-Location"</xref>.
1336+
"targetSchema" describes the resource on the target end of the link, while
1337+
"targetMediaType" defines that resource's media type. With HTTP links,
1338+
"headerSchema" can also be used to describe valid values for use in an
1339+
"Accept" request header, which can support multiple media types or
1340+
media ranges. When both ways of indicating the target media type are
1341+
present, "targetMediaType" SHOULD indicate the default representation
1342+
media type, while the schema for "accept" in "headerSchema" SHOULD include
1343+
the default as well as any alternate media types or media ranges that can
1344+
be requested.
1345+
</t>
1346+
<t>
1347+
Since the semantics of many HTTP methods are defined in terms of the target
1348+
resource, "targetSchema" is used for requests and/or responses for several
1349+
HTTP methods.
13391350
In particular, "targetSchema" suggests what a client can expect for the
13401351
response to an HTTP GET or any response for which the "Content-Location"
13411352
header is equal to the request URI, and what a client should send if it
13421353
replaces the resource in an HTTP PUT request.
1343-
</t>
1344-
<t>
1345-
The media type of the representation is given by the "targetMediaType"
1346-
field. Alternatively, possible available media types MAY be advertised
1347-
for HTTP-accessible resources using the "accept" field in "headerSchema",
1348-
corresponding to the HTTP "Accept" header.
1354+
These correlations are defined by <xref target="RFC7231">RFC 7231,
1355+
section 4.3.1 - "GET", section 4.3.4 "PUT", and section 3.1.4.2,
1356+
"Content-Location"</xref>.
13491357
</t>
13501358
<t>
13511359
Per <xref target="RFC5789">RFC 5789</xref>, the request structure for an HTTP
13521360
PATCH is determined by the combination of "targetSchema" and the request
1353-
media type, which is conveyed by the "Accept-Patch" header. Media types
1354-
that are suitable for PATCH-ing define a syntax for expressing changes
1355-
to a document, which can be applied to the representation described by
1356-
"targetSchema" to determine the set of syntactically valid request payloads.
1357-
Often, the simplest way to validate a PATCH is to apply it and validate
1358-
the result as a normal representation.
1361+
media type, which is conveyed by the "Accept-Patch" header, which may be
1362+
included in "targetHints". Media types that are suitable for PATCH-ing
1363+
define a syntax for expressing changes to a document, which can be applied
1364+
to the representation described by "targetSchema" to determine the set of
1365+
syntactically valid request payloads. Often, the simplest way to validate
1366+
a PATCH request is to apply it and validate the result as a normal
1367+
representation.
13591368
</t>
13601369
<t>
13611370
HTTP POST request payloads are described by the "submissionSchema" and

0 commit comments

Comments
 (0)