|
401 | 401 |
|
402 | 402 | <section title="Valid values">
|
403 | 403 | <t>
|
404 |
| - The value for this keyword MUST be a string, and MUST be a valid URI reference. |
| 404 | + The value for this keyword MUST be a string, and MUST be a valid URI-reference [RFC3986]. |
405 | 405 | This URI SHOULD be normalized, and SHOULD NOT be an empty fragment (#) or the empty string.
|
406 | 406 | </t>
|
407 | 407 | </section>
|
408 | 408 |
|
409 | 409 | <section title="Usage">
|
410 | 410 | <t>
|
411 |
| - The "id" keyword is used to give the document a URI and set its base URI for resolving URI references against. |
412 |
| - When an id is encountered, an implementation MUST resolve this id against |
413 |
| - the parent environment base URI. The resolved URI will be the new base URI for |
414 |
| - the rest of the schema and all child schemas, until another "id" is encountered. |
| 411 | + The "id" keyword defines the URI of the schema and the base URI that other URI references within |
| 412 | + the schema are resolved against. The "id" keyword itself is resolved against a base URI as |
| 413 | + specified in [RFC3986]. |
415 | 414 | </t>
|
416 |
| - |
417 | 415 | <t>
|
418 |
| - When using "id" to alter the base URI, schema authors SHOULD ensure |
419 |
| - that the URI is unique within the schema. |
| 416 | + The outermost schema of a JSON Schema document SHOULD be an absolute-URI (containing a scheme, but no fragment) |
| 417 | + or an absolute-URI with an empty fragment. |
420 | 418 | </t>
|
421 |
| - |
422 | 419 | <t>
|
423 |
| - This schema will be taken as an example: |
| 420 | + For example: |
424 | 421 | </t>
|
425 |
| - |
426 |
| - <!-- |
427 |
| - FIXME: http again as a scheme, maybe another one? It can be any scheme after |
428 |
| - all |
429 |
| - --> |
430 | 422 | <figure>
|
431 | 423 | <artwork>
|
432 | 424 | <![CDATA[
|
433 | 425 | {
|
434 |
| - "id": "http://x.y.z/rootschema.json#", |
| 426 | + "id": "http://example.com/rootschema.json#", |
435 | 427 | "schema1": {
|
436 | 428 | "id": "#foo"
|
437 | 429 | },
|
|
445 | 437 | }
|
446 | 438 | },
|
447 | 439 | "schema3": {
|
448 |
| - "id": "some://where.else/completely#" |
| 440 | + "id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f" |
449 | 441 | }
|
450 | 442 | }
|
451 | 443 | ]]>
|
|
458 | 450 | base URIs:
|
459 | 451 |
|
460 | 452 | <list style="hanging">
|
461 |
| - <t hangText="# (document root)">http://x.y.z/rootschema.json#</t> |
462 |
| - <t hangText="#/schema1">http://x.y.z/rootschema.json#foo</t> |
463 |
| - <t hangText="#/schema2">http://x.y.z/otherschema.json#</t> |
464 |
| - <t hangText="#/schema2/nested">http://x.y.z/otherschema.json#bar</t> |
465 |
| - <t hangText="#/schema2/alsonested">http://x.y.z/t/inner.json#a</t> |
466 |
| - <t hangText="#/schema3">some://where.else/completely#</t> |
| 453 | + <t hangText="# (document root)">http://example.com/rootschema.json#</t> |
| 454 | + <t hangText="#/schema1">http://example.com/rootschema.json#foo</t> |
| 455 | + <t hangText="#/schema2">http://example.com/otherschema.json#</t> |
| 456 | + <t hangText="#/schema2/nested">http://example.com/otherschema.json#bar</t> |
| 457 | + <t hangText="#/schema2/alsonested">http://example.com/t/inner.json#a</t> |
| 458 | + <t hangText="#/schema3">urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f</t> |
467 | 459 | </list>
|
468 | 460 | </t>
|
469 | 461 |
|
|
0 commit comments