You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This removes the "method" keyword and reworks all references to
HTML forms. The difference in approach between JSON Hyper-Schema
and HTML+JavaScript is explained, and the different sorts of links
(in terms of data usage) are described.
The "form" keyword is being added to indicate HTML POST form
semantics. GET forms can be simulated with "hrefSchema", and the
guidance on that has been made more clear.
We also now clearly acknowldege that you cannot directly specify
HTML methods, as that was the largest source of confusion in the
feedback to the previous draft.
Copy file name to clipboardExpand all lines: jsonschema-hyperschema.xml
+121-67
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@
10
10
<!ENTITYrfc5988 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5988.xml">
11
11
<!ENTITYrfc6570 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6570.xml">
12
12
<!ENTITYrfc7231 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7231.xml">
13
-
<!ENTITYhtml5 SYSTEM "http://xml.resource.org/public/rfc/bibxml4/reference.W3C.CR-html5-20140731.xml">
13
+
<!ENTITYhtml5 SYSTEM "http://xml.resource.org/public/rfc/bibxml4/reference.W3C.REC-html5-20141028.xml">
14
14
]>
15
15
<?rfc toc="yes"?>
16
16
<?rfc symrefs="yes"?>
@@ -388,35 +388,93 @@
388
388
The URI of the normative link description schema is: <ereftarget="http://json-schema.org/draft-04/links">http://json-schema.org/draft-04/links</eref> (draft-04 version).
389
389
</t>
390
390
391
-
<sectiontitle="Links and data">
391
+
<sectiontitle="Links, operations, and data">
392
392
<t>
393
-
"Form"-like functionality can be defined by use of the <xreftarget="method">"method"</xref> and <xreftarget="submissionSchema">"submissionSchema"</xref> keywords, which supplies a schema describing the data to supply to the server.
394
-
Functionality equivalent to dynamic URI generation is available through the <xreftarget="href">"href"</xref> template and <xreftarget="hrefSchema">"hrefSchema"</xref>.
395
-
</t>
396
-
<t>
397
-
The simplest kind of link has an "href" with no template variables, and no "submissionSchema". This does not
398
-
allow for any variance in the link URI, nor does it allow for a request document.
393
+
<cref>
394
+
Note that while the current draft does not provide a way to explicity
395
+
indicate HTTP method support, some way of providing a non-authoritative
396
+
hint may be added in a future draft (see issue #73 in the GitHub repository).
397
+
</cref>
399
398
</t>
400
399
<t>
401
-
An "href" with at least one template variable, but no "hrefSchema" or "submissionSchema", allows resolving
402
-
the template variable from the instance, but does not allow resolving it
403
-
from external data, nor does it allow a request document.
400
+
Link Description Objects do not directly indicate what operations, such
401
+
as HTTP methods for links with "http(s)://" URI schemes, are supported by
402
+
the target resource. Instead, operations should be inferred primarily from
403
+
link <xreftarget="rel">relation types</xref> and URI schemes. Additionally,
404
+
the presence of keywords related to data use often implies support for certain
405
+
operations. Note, however, that a resource may always decline an operation at
406
+
runtime, for instance due to application state that controls the operation's
407
+
availability.
404
408
</t>
405
409
<t>
406
-
An "href" with at least one template variable and with an "hrefSchema" allows using external
407
-
data to resolve the template, and falls back to resolving any remaining variables from the instance.
410
+
There are several ways that a client can use data can with a link:
411
+
<list>
412
+
<t> URI Template variables resolved from server-supplied instance data </t>
413
+
<t> URI Template variables resolved from client input</t>
414
+
<t> Replacing or modifying the target resource's representation </t>
415
+
<t> Submitting data for processing, where the data has no
416
+
inherent relation to the target resource's representation</t>
417
+
</list>
408
418
</t>
409
419
<t>
410
-
A link with a "submissionSchema" allows submitting external data either as a request body (if "method" is "post"),
411
-
or as a URI query string (if "method" is "get"). Such a query string replaces any query string
412
-
present after the "href" template is resolved.
420
+
In the human-oriented web, these cases are implemented through
421
+
a combination of HTML and JavaScript. The relatively rapid evolution
422
+
and broad adoption of JavaScript reduced the need to include all
423
+
features in HTML itself.
413
424
</t>
414
425
<t>
415
-
See the individual keyword descriptions below for details related to each of these cases.
426
+
Since JSON Hyper-Schema addresses all of these cases, and is consumed
427
+
primarily by client code rather than human users, its mechanisms do not
428
+
exactly match those of HTML. Instead, three schema keywords describe
429
+
the different kinds of input. Unless otherwise specified, schema keywords
430
+
are ignored when performing operations to which they are not semantically
431
+
relevant.
416
432
</t>
433
+
<sectiontitle="Resolving templated URIs">
434
+
<t>
435
+
URI Template variables in <xreftarget="href">"href"</xref> resolve from
436
+
server-supplied instance data by default.
437
+
<xreftarget="hrefSchema">"hrefSchema"</xref> allows a link to specify
438
+
a schema for resolving template variables from client-supplied data.
439
+
Regular JSON Schema validation features can be used to require resolution
440
+
for client data, forbid it, or allow client data while falling back to
441
+
server-supplied instance data if no client data is provided.
442
+
</t>
443
+
<t>
444
+
This offers a superset of traditional HTML GET forms, and a subset of all
445
+
possible URI construction that can be performed by JavaScript. To simulate
446
+
an HTML GET form, a link can require client input to all query string variables,
447
+
and forbid client input for all other template variables.
448
+
</t>
449
+
</section>
450
+
<sectiontitle="Manipulating the target resource representation">
451
+
<t>
452
+
HTML does not directly support target resource representation manipulation
453
+
through forms. Instead, JavaScript accomplishes this by intercepting the
454
+
form submission and using the appropriate HTTP request with the form data.
455
+
In JSON Hyper-Schema, <xreftarget="targetSchema">"targetSchema"</xref>
456
+
supplies a non-authoritative description of the target resource's representation.
457
+
A client can use "targetSchema" to structure input, or (if it is absent or
458
+
if the client prefers to only use authoritative information), interact with
459
+
the target resource to confirm or discover its representation structure.
460
+
</t>
461
+
</section>
462
+
<sectiontitle="Submitting data for processing">
463
+
<t>
464
+
The <xreftarget="submissionSchema">"submissionSchema"</xref> and
describe the domain of the processing function implemented by the target resource.
467
+
This directly corresponds to HTML "method"="post" forms.
468
+
The <xreftarget="form">"form"</xref>
469
+
keyword can be used to enforce strict semantic compatibility with HTML "post"
470
+
forms, limiting operations to those that make use of the submission data.
471
+
Otherwise, as noted above, the submission schema and encoding are ignored
472
+
for operations to which they are not relevant.
473
+
</t>
474
+
</section>
417
475
</section>
418
476
419
-
<!-- Possibly include a short section on motivations, including triples, resources, and progressive disclosure -->
477
+
<!-- Possibly include a short section on motivations, including triples, resources, and progressive disclosure -->
420
478
421
479
<sectiontitle="href"anchor="href">
422
480
<t>
@@ -512,6 +570,10 @@
512
570
months for date-time input but using the standard date-time
513
571
format for storage.
514
572
</t>
573
+
<t>
574
+
Omitting this keyword has the same behavior as a schema of false,
575
+
which forbids all external data input.
576
+
</t>
515
577
<figure>
516
578
<preamble>
517
579
For example, this defines a schema for each of the query string
@@ -579,13 +641,13 @@
579
641
</figure>
580
642
<t>
581
643
<cref>
582
-
The above example simulates the behavior found in earlier drafts using only "hrefSchema",
583
-
which would allow the concurrent use of "submissionSchema" on a "post" link.
644
+
The above example simulates the HTML GET form behavior found in earlier drafts
645
+
using only "hrefSchema", which is necessary now that "method" has been removed.
584
646
</cref>
585
647
</t>
586
648
</section>
587
649
588
-
<sectiontitle="rel">
650
+
<sectiontitle="rel"anchor="rel">
589
651
<t>
590
652
The value of the "rel" property indicates the name of the relation to the target resource. The value MUST be a registered link relation from the <xreftarget="RFC5988">IANA Link Relation Type Registry established in RFC 5988</xref>, or a normalized URI following the <xreftarget="RFC3986">URI production of RFC 3986</xref>.
591
653
</t>
@@ -863,69 +925,54 @@ GET /foo/
863
925
</section>
864
926
</section>
865
927
866
-
<sectiontitle="Submission Form Properties">
928
+
<sectiontitle="Data Submission Properties">
867
929
<t>
868
-
The following properties also apply to Link Description Objects, and provide functionality analogous to <xreftarget="W3C.CR-html5-20140731">HTML forms</xref>, by providing a means for making a request with client- or user-selected information.
930
+
The following properties also apply to Link Description Objects,
931
+
and provide the ability to describe data for submission to the
932
+
target resource for processing, independent of manipulating the
933
+
target resource's representation.
869
934
</t>
870
935
871
-
<sectiontitle="method"anchor="method">
936
+
<sectiontitle="form"anchor="form">
937
+
<t>
938
+
The value of this keyword is a boolean.
939
+
</t>
872
940
<t>
873
-
This property specifies that the client can construct a templated query or non-idempotent request to a resource.
941
+
Setting this keyword to true indicates that this link has
This imposes additional constraints that are not present if
945
+
the value of this keyword is false.
874
946
</t>
875
947
<t>
876
-
If "method" is "get", the link identifies how a user can compute the URI of an arbitrary resource. For example, how to compute a link to a page of search results relating to the instance, for a user-selected query term. Despite being named after GET, there is no constraint on the method or protocol used to interact with the remote resource.
948
+
In particular, if "form" is true, request payloads SHOULD conform
949
+
to <xreftarget="submissionSchema">"submissionSchema"</xref>
950
+
and <xreftarget="submissionEncType">"submissionEncType"</xref>,
951
+
and the link MUST NOT be used with operations that are incompatible
952
+
with those semantics.
877
953
</t>
878
954
<t>
879
-
If "method" is "post", the link specifies how a user can construct a document to submit to the link target for evaluation.
955
+
Note that <xreftarget="hrefSchema">"hrefSchema"</xref> already offers a superset
956
+
of the functionality of HTML GET forms, so there is no explicit
957
+
analogue for that aspect of HTML.
880
958
</t>
881
959
<t>
882
-
Values for this property SHOULD be lowercase, and SHOULD be compared case-insensitive. Use of other values not defined here SHOULD be ignored.
960
+
Omitting this keyword has the same behavior as a value of false.
This property contains a schema which defines the acceptable structure of the document being encoded according to the "submissionEncType" property.
1019
+
This property contains a schema which defines the
1020
+
acceptable structure of the document being submitted
1021
+
for processing by
1022
+
according to the "submissionEncType" property.
974
1023
</t>
975
1024
976
1025
<t>
977
1026
Note that this does not define the structure for URI template variables. That is handed by <xreftarget="hrefSchema">"hrefSchema"</xref>. If the method is "get" and the resolved URI Template has a query string, the query string produced by input validated against "submissionSchema" replaces the existing query string.
978
1027
</t>
1028
+
<t>
1029
+
This can be viewed as describing the domain of the processing
1030
+
function implemented by the target resource.
1031
+
</t>
979
1032
980
1033
<t>
981
1034
This is a separate concept from the <xreftarget="targetSchema">"targetSchema"</xref> property, which is describing the target information resource (including for replacing the contents of the resource in a PUT request), unlike "submissionSchema" which describes the user-submitted request data to be evaluated by the resource.
@@ -1061,6 +1114,7 @@ GET /foo/
1061
1114
<t>Clarified HTTP use with "targetSchema"</t>
1062
1115
<t>Renamed "schema" to "submissionSchema"</t>
1063
1116
<t>Renamed "encType" to "submissionEncType"</t>
1117
+
<t>Removed "method", add "form" for HTML "post" form semantics</t>
0 commit comments