Skip to content

Commit 0905d86

Browse files
committed
Trim down JSON Hyper-Schemas in APIs appendix
A lot of this should go on some sort of best practices guide on the web site. This cuts quite a bit of text, and merges the static analysis appendix into the API appendex as API-wide processing is the main use case for such analysis. There is likely more to cut, and perhaps the entire appendix should be removed, but I'd like to get some feedback on this level of information first.
1 parent e924eb8 commit 0905d86

File tree

1 file changed

+33
-88
lines changed

1 file changed

+33
-88
lines changed

jsonschema-hyperschema.xml

Lines changed: 33 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<!ENTITY rfc6901 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6901.xml">
1414
<!ENTITY rfc7230 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7230.xml">
1515
<!ENTITY rfc7231 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7231.xml">
16+
<!ENTITY rfc7807 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7807.xml">
1617
<!ENTITY I-D.nottingham-rfc5988bis SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.draft-nottingham-rfc5988bis-08.xml">
1718
<!ENTITY I-D.luff-relative-json-pointer SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.draft-luff-relative-json-pointer-00.xml">
1819
<!ENTITY I-D.reschke-http-jfv SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.draft-reschke-http-jfv-06.xml">
@@ -1347,6 +1348,7 @@ for varname in templateData:
13471348
&rfc6573;
13481349
&rfc7230;
13491350
&rfc7231;
1351+
&rfc7807;
13501352
&I-D.nottingham-rfc5988bis;
13511353
</references>
13521354
<section title="JSON Hyper-Schema and HTTP" anchor="HTTP">
@@ -1487,18 +1489,10 @@ for varname in templateData:
14871489
style, enable the creation of generic user agents. Such a user agent
14881490
has no application-specific knowledge. Rather, it understands pre-defined
14891491
media types, URI schemes, protocols, and link relations, often by recognizing
1490-
these and coordinating the use of existing software that implement support
1491-
for them. Applications can then be built on top of such a user agent, focusing
1492-
on their own semantics and logic rather than the mechanics of the interactions.
1493-
</t>
1494-
<t>
1495-
JSON Hyper-Schema is ideal for representing individual resources in hypermedia
1496-
APIs. It offers comprehensive capabilities for describing how to use hyperlinks
1497-
to interact with the current resource (through "self" links), or related
1498-
resources. Using a hyper-schema-based API involves traversing links from
1499-
one resource to the next, interacting with resources through their
1500-
representations as described by the target keywords, or submitting data
1501-
to resources for processing using the submission keywords.
1492+
these and coordinating the use of existing software that implements support
1493+
for them. Client applications can then be built on top of such a user agent,
1494+
focusing on their own semantics and logic rather than the mechanics of the
1495+
interactions.
15021496
</t>
15031497
<t>
15041498
Hyper-schema is only concerned with one resource and set of associated links
@@ -1508,35 +1502,12 @@ for varname in templateData:
15081502
any concept of whether or how that resource fits into an API.
15091503
</t>
15101504
<t>
1511-
While aspects of cross-cutting API concerns such as authentication
1512-
and authorization may be described in hyper-schema, for instance in
1513-
the headerSchema of a link, defining an API-wide approach to any
1514-
cross-cutting concerns is beyond the scope of hyper-schema.
1505+
Therefore, hyper-schema is suitable for use within an API, but is not suitable
1506+
for the description of APIs as complete entities in their own right. There is
1507+
no way to describe concepts at the API scope, rather than the resource and
1508+
link scope, and such descriptions are outside of the boundaries
1509+
of JSON Hyper-Schema.
15151510
</t>
1516-
<section title="Separation of concerns">
1517-
<t>
1518-
Working with a JSON Hyper-Schema-based API will generally involve
1519-
three components: The hyper-schema implementation, a generic user agent,
1520-
and a client application. The hyper-schema implementation's requirements
1521-
are given in this specification. The generic user agent handles standardized
1522-
URI schemes, protocols, and media types. User agents that handle HTTP,
1523-
HTTPS, and JSON, for instance, are available as libraries in many programming
1524-
languages.
1525-
</t>
1526-
<t>
1527-
The client application has the domain-specific knowledge of link relation
1528-
types and data structure fields needed to make use of the specific API.
1529-
A client application can use an available user agent library and a hyper-schema
1530-
implementation separately. Alternatively, extensible user agents can allow
1531-
adding hyper-schema support as a plug-in alongside support for plain JSON, XML,
1532-
or other media types.
1533-
</t>
1534-
<t>
1535-
<cref>
1536-
Add something about generic user agents not being magic, HATEOAS, etc.
1537-
</cref>
1538-
</t>
1539-
</section>
15401511
<section title="Resource evolution with Hyper-Schema">
15411512
<t>
15421513
Since a given JSON Hyper-Schema is used with a single resource at a single
@@ -1552,67 +1523,41 @@ for varname in templateData:
15521523
can then make use of the hyper-schema that it recognizes, and ignore newer
15531524
or older versions.
15541525
</t>
1555-
<t>
1556-
Note that this notion of changing the representaiton version using
1557-
successive hyper-schemas is separate from deprecating an entire resource
1558-
and either removing it or replacing it with a new resource at a new URI.
1559-
The "targetHints" keyword can be used to convey deprecation information.
1560-
</t>
1561-
<t>
1562-
<cref>
1563-
This section is something of a placeholder, with the goal being to
1564-
get readers to understand that while hyper-schema helps with versioning,
1565-
it does not and will not have explicit features to support it.
1566-
</cref>
1567-
</t>
1568-
</section>
1569-
<section title="Entry point resource">
1570-
<t>
1571-
To create an entry point for an API, it is RECOMMENDED to provide
1572-
a resource at a documented entry point URI with the minimal amount of data
1573-
necessary to begin interacting with API resources.
1574-
The hyper-schema for this resource SHOULD contain links to all
1575-
API resources that can be accessed with only user input and/or
1576-
data contained in the entry point resource's representation.
1577-
</t>
15781526
</section>
15791527
<section title="Responses and errors">
15801528
<t>
15811529
Because a hyper-schema represents a single resource at a time, it does not
15821530
provide for an enumeration of all possible responses to protocol operations
15831531
performed with links. Each response, including errors, is considered
15841532
its own (possibly anonymous) resource, and should identify its own
1585-
hyper-schema to allow the user agent or client application to interpret any
1533+
hyper-schema, and optionally use an appropriate media type such as
1534+
<xref target="RFC7807">RFC 7807's "application/problem+json"</xref>,
1535+
to allow the user agent or client application to interpret any
15861536
information that is provided beyond the protocol's own status reporting.
15871537
</t>
1538+
</section>
1539+
<section title="Static analysis of an API's hyper-schemas">
1540+
<t>
1541+
It is possible to statically analyze a set of hyper-schemas without instance
1542+
data in order to generate output such as documentation or code. However,
1543+
the full feature set of both validation and hyper-schema cannot be accessed
1544+
without runtime instance data.
1545+
</t>
15881546
<t>
1589-
Protocol and media type specifications provide the necessary information to
1590-
deal with different responses at runtime, while documenting all responses
1591-
is a concern static analysis across all hyper-schemas making up an API.
1547+
This is an intentional design choice to provide the maximum runtime
1548+
flexibility for hypermedia systems. JSON Schema as a media type allows for
1549+
establishing additional vocabularies for static analysis and content
1550+
generation, which are not addressed in this specification. Additionally,
1551+
individual systems may restrict their usage to subsets that can be
1552+
analyzed statically if full design-time description is a goal.
1553+
<cref>
1554+
Vocabularies for API documentation and other purposes have been
1555+
proposed, and contributions are welcome at
1556+
https://github.com/json-schema-org/json-schema-vocabularies
1557+
</cref>
15921558
</t>
15931559
</section>
15941560
</section>
1595-
<section title="Static analysis of hyper-schemas">
1596-
<t>
1597-
It is possible to statically analyze a set of hyper-schemas without instance
1598-
data in order to generate output such as documentation or code. However,
1599-
the full feature set of both validation and hyper-schema cannot be accessed
1600-
without runtime instance data.
1601-
</t>
1602-
<t>
1603-
This is an intentional design choice to provide the maximum runtime
1604-
flexibility for hypermedia systems. JSON Schema as a media type allows for
1605-
establishing additional vocabularies for static analysis and content
1606-
generation, which are not addressed in this specification. Additionally,
1607-
individual systems may restrict their usage to subsets that can be
1608-
analyzed statically if full design-time description is a goal.
1609-
<cref>
1610-
Vocabularies for API documentation and other purposes have been
1611-
proposed, and contributions are welcome at
1612-
https://github.com/json-schema-org/json-schema-vocabularies
1613-
</cref>
1614-
</t>
1615-
</section>
16161561

16171562
<section title="Change Log">
16181563
<t>

0 commit comments

Comments
 (0)