|
347 | 347 | </t>
|
348 | 348 | </section>
|
349 | 349 |
|
350 |
| - <section title='The "id" keyword'> |
| 350 | + <section title='The "$id" keyword'> |
351 | 351 | <t>
|
352 |
| - The "id" keyword defines a URI for the schema, |
| 352 | + The "$id" keyword defines a URI for the schema, |
353 | 353 | and the base URI that other URI references within the schema are resolved against.
|
354 |
| - The "id" keyword itself is resolved against the base URI that the object as a whole appears in. |
| 354 | + The "$id" keyword itself is resolved against the base URI that the object as a whole appears in. |
355 | 355 | </t>
|
356 | 356 | <t>
|
357 | 357 | If present, the value for this keyword MUST be a string, and MUST represent a valid <xref target="RFC3986">URI-reference</xref>.
|
358 | 358 | This value SHOULD be normalized, and SHOULD NOT be an empty fragment <#> or an empty string <>.
|
359 | 359 | </t>
|
360 | 360 | <t>
|
361 |
| - The root schema of a JSON Schema document SHOULD contain an "id" keyword with an absolute-URI (containing a scheme, but no fragment). |
| 361 | + The root schema of a JSON Schema document SHOULD contain an "$id" keyword with an absolute-URI (containing a scheme, but no fragment). |
362 | 362 | </t>
|
363 | 363 | <t>
|
364 | 364 | To name subschemas in a JSON Schema document,
|
365 |
| - subschemas can use "id" to give themselves a document-local identifier. |
366 |
| - This form of "id" keyword MUST begin with a hash ("#") to identify it as a fragment URI reference, |
| 365 | + subschemas can use "$id" to give themselves a document-local identifier. |
| 366 | + This form of "$id" keyword MUST begin with a hash ("#") to identify it as a fragment URI reference, |
367 | 367 | followed by a letter ([A-Za-z]), followed by any number of
|
368 | 368 | letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), or periods (".").
|
369 | 369 | <!-- This restriction is the same one defined by XML -->
|
|
374 | 374 | <artwork>
|
375 | 375 | <![CDATA[
|
376 | 376 | {
|
377 |
| - "id": "http://example.com/root.json", |
| 377 | + "$id": "http://example.com/root.json", |
378 | 378 | "definitions": {
|
379 |
| - "A": { "id": "#foo" }, |
| 379 | + "A": { "$id": "#foo" }, |
380 | 380 | "B": {
|
381 |
| - "id": "other.json", |
| 381 | + "$id": "other.json", |
382 | 382 | "definitions": {
|
383 |
| - "X": { "id": "#bar" }, |
384 |
| - "Y": { "id": "t/inner.json" } |
| 383 | + "X": { "$id": "#bar" }, |
| 384 | + "Y": { "$id": "t/inner.json" } |
385 | 385 | }
|
386 | 386 | },
|
387 | 387 | "C": {
|
388 |
| - "id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f" |
| 388 | + "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f" |
389 | 389 | }
|
390 | 390 | }
|
391 | 391 | }
|
|
411 | 411 | <section title="Internal references">
|
412 | 412 | <t>
|
413 | 413 | Schemas can be identified by any URI that has been given to them, including a JSON Pointer or
|
414 |
| - their URI given directly by "id". |
| 414 | + their URI given directly by "$id". |
415 | 415 | </t>
|
416 | 416 | <t>
|
417 |
| - Tools SHOULD take note of the URIs that schemas, including subschemas, provide for themselves using "id". |
| 417 | + Tools SHOULD take note of the URIs that schemas, including subschemas, provide for themselves using "$id". |
418 | 418 | This is known as "Internal referencing".
|
419 | 419 | </t>
|
420 | 420 |
|
|
426 | 426 | <artwork>
|
427 | 427 | <![CDATA[
|
428 | 428 | {
|
429 |
| - "id": "http://example.net/root.json", |
| 429 | + "$id": "http://example.net/root.json", |
430 | 430 | "items": {
|
431 | 431 | "type": "array",
|
432 | 432 | "items": { "$ref": "#item" }
|
433 | 433 | },
|
434 | 434 | "definitions": {
|
435 | 435 | "single": {
|
436 |
| - "id": "#item", |
| 436 | + "$id": "#item", |
437 | 437 | "type": "integer"
|
438 | 438 | },
|
439 | 439 | }
|
|
442 | 442 | </artwork>
|
443 | 443 | </figure>
|
444 | 444 | <t>
|
445 |
| - When an implementation encounters the <#/definitions/single> schema, it resolves the "id" URI reference |
| 445 | + When an implementation encounters the <#/definitions/single> schema, it resolves the "$id" URI reference |
446 | 446 | against the current base URI to form <http://example.net/root.json#item>.
|
447 | 447 | </t>
|
448 | 448 | <t>
|
|
458 | 458 | </t>
|
459 | 459 | <t>
|
460 | 460 | Implementations SHOULD be able to associate arbitrary URIs with an arbitrary schema and/or
|
461 |
| - automatically associate a schema's "id"-given URI, depending on the trust that the the validator |
| 461 | + automatically associate a schema's "$id"-given URI, depending on the trust that the the validator |
462 | 462 | has in the schema.
|
463 | 463 | </t>
|
464 | 464 | <t>
|
@@ -587,7 +587,7 @@ User-Agent: so-cool-json-schema/1.0.2 curl/7.43.0
|
587 | 587 | Validators MUST NOT fall into an infinite loop.
|
588 | 588 | </t>
|
589 | 589 | <t>
|
590 |
| - Servers need to take care that malicious parties can't change the functionality of existing schemas by uploading a schema with an pre-existing or very similar "id". |
| 590 | + Servers need to take care that malicious parties can't change the functionality of existing schemas by uploading a schema with an pre-existing or very similar "$id". |
591 | 591 | </t>
|
592 | 592 | <t>
|
593 | 593 | Individual JSON Schema vocabularies are liable to also have their own security considerations. Consult the respective specifications for more information.
|
@@ -681,6 +681,7 @@ User-Agent: so-cool-json-schema/1.0.2 curl/7.43.0
|
681 | 681 | <list style="symbols">
|
682 | 682 | <t>Updated intro</t>
|
683 | 683 | <t>Allowed for any schema to be a boolean</t>
|
| 684 | + <t>Changed "id" to "$id"; all core keywords prefixed with "$"</t> |
684 | 685 | </list>
|
685 | 686 | </t>
|
686 | 687 | <t hangText="draft-wright-json-schema-00">
|
|
0 commit comments