|
366 | 366 | The URI of the normative link description schema is: <eref target="http://json-schema.org/draft-04/links">http://json-schema.org/draft-04/links</eref> (draft-04 version).
|
367 | 367 | </t>
|
368 | 368 |
|
369 |
| - <t> |
370 |
| - "Form"-like functionality can be defined by use of the "method" and "schema" keywords, which supplies a schema describing the data to supply to the server. |
371 |
| - </t> |
| 369 | + <section title="Links and data"> |
| 370 | + <t> |
| 371 | + "Form"-like functionality can be defined by use of the <xref target="method">"method"</xref> and <xref target="schema">"schema"</xref> keywords, which supplies a schema describing the data to supply to the server. |
| 372 | + Functionality equivalent to dynamic URI generation is available through the <xref target="href">"href"</xref> template and <xref target="hrefSchema">"hrefSchema"</xref>. |
| 373 | + </t> |
| 374 | + <t> |
| 375 | + The simplest kind of link has an "href" with no template variables, and no "schema". This does not |
| 376 | + allow for any variance in the link URI, nor does it allow for a request document. |
| 377 | + </t> |
| 378 | + <t> |
| 379 | + An "href" with at least one template variable, but no "hrefSchema" or "schema", allows resolving |
| 380 | + the template variable from the instance, but does not allow resolving it |
| 381 | + from external data, nor does it allow a request document. |
| 382 | + </t> |
| 383 | + <t> |
| 384 | + An "href" with at least one template variable and with an "hrefSchema" allows using external |
| 385 | + data to resolve the template, and falls back to resolving any remaining variables from the instance. |
| 386 | + </t> |
| 387 | + <t> |
| 388 | + A link with a "schema" allows submitting external data either as a request body (if "method" is "post"), |
| 389 | + or as a URI query string (if "method" is "get"). Such a query string replaces any query string |
| 390 | + present after the "href" template is resolved. |
| 391 | + </t> |
| 392 | + <t> |
| 393 | + See the individual keyword descriptions below for details related to each of these cases. |
| 394 | + </t> |
| 395 | + </section> |
372 | 396 |
|
373 | 397 | <!-- Possibly include a short section on motivations, including triples, resources, and progressive disclosure -->
|
374 | 398 |
|
|
473 | 497 |
|
474 | 498 | <section title="Values for substitution">
|
475 | 499 | <t>
|
476 |
| - After pre-processing, the URI Template is filled out using data from some combination of user input and the instance. |
| 500 | + After pre-processing, the URI Template is filled out using data from some combination of an externa source and the instance. |
| 501 | + Where either instance data or external data may be used, this section will refer simply to "data" or to a "value". |
| 502 | + When the source is important, it is specified explicitly. |
477 | 503 |
|
478 | 504 | To allow the use of any object property (including the empty string), array index, or the instance value itself, the following rules are defined:
|
479 | 505 | </t>
|
480 | 506 |
|
481 | 507 | <t>
|
482 | 508 | For a given variable name in the URI Template, the value to use is determined as follows:
|
483 | 509 | <list>
|
484 |
| - <t>If the variable name is "%73elf", then the instance value itself MUST be used.</t> |
485 |
| - <t>If the variable name is "%65mpty", then the instances's empty-string ("") property MUST be used (if it exists).</t> |
486 |
| - <t>If the instance is an array, and the variable name is a representation of a non-negative integer, then the value at the corresponding array index MUST be used (if it exists).</t> |
| 510 | + <t>If the variable name is "%73elf", then the value itself MUST be used.</t> |
| 511 | + <t>If the variable name is "%65mpty", then the empty-string ("") property MUST be used (if it exists).</t> |
| 512 | + <t>If the data is an array, and the variable name is a representation of a non-negative integer, then the value at the corresponding array index MUST be used (if it exists).</t> |
487 | 513 | <t>Otherwise, the variable name should be percent-decoded, and the corresponding object property MUST be used (if it exists).</t>
|
488 | 514 | </list>
|
489 | 515 | </t>
|
490 | 516 |
|
491 | 517 | <t>
|
492 | 518 | If <xref target="hrefSchema">"hrefSchema"</xref> is present and
|
493 |
| - user input is provided, the input MUST be valid according to the value of "hrefSchema". |
| 519 | + external input is provided, the input MUST be a valid instance according |
| 520 | + to the value of "hrefSchema". |
494 | 521 | Template variables, after the process listed above, MUST first
|
495 |
| - be resolved from the user input instance. Any variables left |
496 |
| - unresolved MUST be resolved from the resource instance. |
| 522 | + be resolved from the external data instance. Any variables left |
| 523 | + unresolved MUST be resolved from the resource instance data. |
497 | 524 | </t>
|
498 | 525 |
|
499 | 526 | <section title="Converting to strings">
|
|
531 | 558 | <t>
|
532 | 559 | The value of the "hrefSchema" link description property MUST be
|
533 | 560 | a valid JSON Schema. This schema is used to validate user input
|
534 |
| - for filling out the URI Template in |
| 561 | + or other external data for filling out the URI Template in |
535 | 562 | <xref target="href">"href"</xref>, as described in that section.
|
536 | 563 | </t>
|
537 | 564 | <t>
|
538 | 565 | Omitting "hrefSchema" or setting the entire schema to "false" prevents
|
539 |
| - any user input from being accepted. |
| 566 | + any external data from being accepted. |
540 | 567 | </t>
|
541 | 568 | <t>
|
542 | 569 | Implementations MUST NOT attempt to validate values resolved from
|
543 |
| - instance data with "hrefSchema". This allows for different |
| 570 | + resource instance data with "hrefSchema". This allows for different |
544 | 571 | validation rules for user input, such as supporting spelled-out
|
545 | 572 | months for date-time input but using the standard date-time
|
546 | 573 | format for storage.
|
|
575 | 602 | <figure>
|
576 | 603 | <preamble>
|
577 | 604 | In this example, the schema for "extra" is given as a reference
|
578 |
| - to keep the user input validation constraints identical to the |
| 605 | + to keep the external data validation constraints identical to the |
579 | 606 | instance validation constraints for the corresponding property,
|
580 |
| - while "id" is given a false schema to prevent user input for |
| 607 | + while "id" is given a false schema to prevent external data for |
581 | 608 | that variable.
|
582 | 609 | </preamble>
|
583 | 610 | <artwork>
|
|
610 | 637 | }]]>
|
611 | 638 | </artwork>
|
612 | 639 | </figure>
|
| 640 | + <t> |
| 641 | + <cref> |
| 642 | + The above example simulates the behavior found in earlier drafts using only "hrefSchema", |
| 643 | + which would allow the concurrent use of "schema" on a "post" link. |
| 644 | + </cref> |
| 645 | + </t> |
613 | 646 | </section>
|
614 | 647 |
|
615 | 648 | <section title="rel">
|
@@ -878,7 +911,7 @@ GET /foo/
|
878 | 911 | The following properties also apply to Link Description Objects, and provide functionality analogous to <xref target="W3C.CR-html5-20140731">HTML forms</xref>, by providing a means for making a request with client- or user-selected information.
|
879 | 912 | </t>
|
880 | 913 |
|
881 |
| - <section title="method"> |
| 914 | + <section title="method" anchor="method"> |
882 | 915 | <t>
|
883 | 916 | This property specifies that the client can construct a templated query or non-idempotent request to a resource.
|
884 | 917 | </t>
|
@@ -933,7 +966,7 @@ GET /foo/
|
933 | 966 | </t>
|
934 | 967 | </section>
|
935 | 968 |
|
936 |
| - <section title="schema"> |
| 969 | + <section title="schema" anchor="schema"> |
937 | 970 | <t>
|
938 | 971 | This property contains a schema which defines the acceptable structure of the document being encoded according to the "encType" property.
|
939 | 972 | </t>
|
|
0 commit comments