|  | 
| 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 "method" and "schema" keywords, which supplies a schema describing the data to supply to the server. | 
|  | 372 | +                    Functionality equivalent to dynamic URI generation is available through the "href" template and "hrefSchema". | 
|  | 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 variable from the instance, but does not allow for the use of any external data. | 
|  | 381 | +                </t> | 
|  | 382 | +                <t> | 
|  | 383 | +                    An "href" with at least one template variable and with an "hrefSchema" allows using external | 
|  | 384 | +                    data to resolve the template, and falls back to resolving any remaining variables from the instance. | 
|  | 385 | +                </t> | 
|  | 386 | +                <t> | 
|  | 387 | +                    A link with a "schema" allows submitting external data either as a request body (if "method" is "post"), | 
|  | 388 | +                    or as a URI query string (if "method" is "get").  Such a query string replaces any query string | 
|  | 389 | +                    from the resolved template in "href". | 
|  | 390 | +                </t> | 
|  | 391 | +                <t> | 
|  | 392 | +                    See the individual keyword descriptions below for details related to each of these cases. | 
|  | 393 | +                </t> | 
|  | 394 | +            </section> | 
| 372 | 395 | 
 | 
| 373 | 396 | 	         <!-- Possibly include a short section on motivations, including triples, resources, and progressive disclosure --> | 
| 374 | 397 | 
 | 
|  | 
| 473 | 496 | 
 | 
| 474 | 497 |                     <section title="Values for substitution"> | 
| 475 | 498 |                         <t> | 
| 476 |  | -                            After pre-processing, the URI Template is filled out using data from some combination of user input and the instance. | 
|  | 499 | +                            After pre-processing, the URI Template is filled out using data from some combination of an externa source and the instance. | 
|  | 500 | +                            Where either instance data or external data may be used, this section will refer simply to "data" or to a "value". | 
|  | 501 | +                            When the source is important, it is specified explicitly. | 
| 477 | 502 | 
 | 
| 478 | 503 |                             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 | 504 |                         </t> | 
| 480 | 505 | 
 | 
| 481 | 506 |                         <t> | 
| 482 | 507 |                             For a given variable name in the URI Template, the value to use is determined as follows: | 
| 483 | 508 |                             <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> | 
|  | 509 | +                                <t>If the variable name is "%73elf", then the value itself MUST be used.</t> | 
|  | 510 | +                                <t>If the variable name is "%65mpty", then the empty-string ("") property MUST be used (if it exists).</t> | 
|  | 511 | +                                <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 | 512 |                                 <t>Otherwise, the variable name should be percent-decoded, and the corresponding object property MUST be used (if it exists).</t> | 
| 488 | 513 |                             </list> | 
| 489 | 514 |                         </t> | 
| 490 | 515 | 
 | 
| 491 | 516 |                         <t> | 
| 492 | 517 |                             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". | 
|  | 518 | +                            external input is provided, the input MUST be a valid instance according | 
|  | 519 | +                            to the value of "hrefSchema". | 
| 494 | 520 |                             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. | 
|  | 521 | +                            be resolved from the external data instance.  Any variables left | 
|  | 522 | +                            unresolved MUST be resolved from the resource instance data. | 
| 497 | 523 |                         </t> | 
| 498 | 524 | 
 | 
| 499 | 525 |                         <section title="Converting to strings"> | 
|  | 
| 531 | 557 |                 <t> | 
| 532 | 558 |                     The value of the "hrefSchema" link description property MUST be | 
| 533 | 559 |                     a valid JSON Schema.  This schema is used to validate user input | 
| 534 |  | -                    for filling out the URI Template in | 
|  | 560 | +                    or other external data for filling out the URI Template in | 
| 535 | 561 |                     <xref target="href">"href"</xref>, as described in that section. | 
| 536 | 562 |                 </t> | 
| 537 | 563 |                 <t> | 
| 538 | 564 |                     Omitting "hrefSchema" or setting the entire schema to "false" prevents | 
| 539 |  | -                    any user input from being accepted. | 
|  | 565 | +                    any external data from being accepted. | 
| 540 | 566 |                 </t> | 
| 541 | 567 |                 <t> | 
| 542 | 568 |                     Implementations MUST NOT attempt to validate values resolved from | 
| 543 |  | -                    instance data with "hrefSchema".  This allows for different | 
|  | 569 | +                    resource instance data with "hrefSchema".  This allows for different | 
| 544 | 570 |                     validation rules for user input, such as supporting spelled-out | 
| 545 | 571 |                     months for date-time input but using the standard date-time | 
| 546 | 572 |                     format for storage. | 
|  | 
| 575 | 601 |                 <figure> | 
| 576 | 602 |                     <preamble> | 
| 577 | 603 |                         In this example, the schema for "extra" is given as a reference | 
| 578 |  | -                        to keep the user input validation constraints identical to the | 
|  | 604 | +                        to keep the external data validation constraints identical to the | 
| 579 | 605 |                         instance validation constraints for the corresponding property, | 
| 580 |  | -                        while "id" is given a false schema to prevent user input for | 
|  | 606 | +                        while "id" is given a false schema to prevent external data for | 
| 581 | 607 |                         that variable. | 
| 582 | 608 |                     </preamble> | 
| 583 | 609 |                     <artwork> | 
|  | 
| 610 | 636 | }]]> | 
| 611 | 637 |                     </artwork> | 
| 612 | 638 |                 </figure> | 
|  | 639 | +                <t> | 
|  | 640 | +                    <cref> | 
|  | 641 | +                        The above example simulates the behavior found in earlier drafts using only "hrefSchema", | 
|  | 642 | +                        which would allow the concurrent use of "schema" on a "post" link. | 
|  | 643 | +                    </cref> | 
|  | 644 | +                </t> | 
| 613 | 645 |             </section> | 
| 614 | 646 | 
 | 
| 615 | 647 |             <section title="rel"> | 
|  | 
0 commit comments