3
3
<!ENTITY RFC2119 SYSTEM " http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml" >
4
4
<!ENTITY RFC3986 SYSTEM " http://xml.resource.org/public/rfc/bibxml/reference.RFC.3986.xml" >
5
5
<!ENTITY RFC5988 SYSTEM " http://xml.resource.org/public/rfc/bibxml/reference.RFC.5988.xml" >
6
+ <!ENTITY RFC6839 SYSTEM " http://xml.resource.org/public/rfc/bibxml/reference.RFC.6839.xml" >
6
7
<!ENTITY RFC6901 SYSTEM " http://xml.resource.org/public/rfc/bibxml/reference.RFC.6901.xml" >
7
8
<!ENTITY RFC6906 SYSTEM " http://xml.resource.org/public/rfc/bibxml/reference.RFC.6906.xml" >
8
9
<!ENTITY RFC7049 SYSTEM " http://xml.resource.org/public/rfc/bibxml/reference.RFC.7049.xml" >
9
10
<!ENTITY RFC7159 SYSTEM " http://xml.resource.org/public/rfc/bibxml/reference.RFC.7159.xml" >
10
11
<!ENTITY RFC7231 SYSTEM " http://xml.resource.org/public/rfc/bibxml/reference.RFC.7231.xml" >
11
12
<!ENTITY ldp SYSTEM " https://xml2rfc.tools.ietf.org/public/rfc/bibxml4/reference.W3C.REC-ldp-20150226.xml" >
13
+ <!ENTITY fragid-best-practices SYSTEM " https://xml2rfc.tools.ietf.org/public/rfc/bibxml4/reference.W3C.WD-fragid-best-practices-20121025.xml" >
12
14
]>
13
15
<?rfc toc =" yes" ?>
14
16
<?rfc symrefs =" yes" ?>
251
253
252
254
</section >
253
255
256
+ <section title =" Fragment identifiers" anchor =" fragments" >
257
+ <t >
258
+ In accordance with section 3.1 of <xref target =" RFC6839" ></xref >,
259
+ the syntax and semantics of fragment identifiers specified for
260
+ any +json media type SHOULD be as specified for "application/json".
261
+ (At publication of this document, there is no fragment identification
262
+ syntax defined for "application/json".)
263
+ </t >
264
+ <t >
265
+ Additionally, the "application/schema+json" media type supports two
266
+ fragment identifier structures: plain names and JSON Pointers.
267
+ The use of JSON Pointers as URI fragment identifiers is described in
268
+ <xref target =" RFC6901" >RFC 6901</xref >.
269
+ Fragment identifiers matching the JSON Pointer syntax, including
270
+ the empty string, MUST be interpreted as JSON Pointer fragment
271
+ identifiers.
272
+ </t >
273
+ <t >
274
+ Per the W3C's
275
+ <xref target =" W3C.WD-fragid-best-practices-20121025" >best practices for fragment identifiers</xref >,
276
+ plain name fragment identifiers are reserved for referencing
277
+ locally named schemas. All fragment identifiers that do
278
+ not match the JSON Pointer syntax MUST be interpreted as
279
+ plain name fragment identifiers.
280
+ </t >
281
+ <t >
282
+ Defining and referencing a plain name fragment identifier
283
+ in the <xref target =" id-keyword" >"$id" keyword</xref > section.
284
+ </t >
285
+ <t >
286
+ </t >
287
+ </section >
288
+
254
289
<section title =" General considerations" >
255
290
256
291
<section title =" Range of JSON values" >
260
295
</t >
261
296
</section >
262
297
263
- <section title =" Programming language independence" >
298
+ <section title =" Programming language independence" anchor = " language " >
264
299
<t >
265
300
JSON Schema is programming language agnostic, and supports the full range of values described in the data model.
266
301
Be aware, however, that some languages and JSON parsers may not be able to represent in memory
267
302
the full range of values describable by JSON.
268
303
</t >
269
304
</section >
270
305
271
- <section title =" Mathematical integers" >
306
+ <section title =" Mathematical integers" anchor = " integers " >
272
307
<t >
273
308
Some programming languages and parsers use different internal representations for floating
274
309
point numbers than they do for integers.
352
387
</t >
353
388
</section >
354
389
355
- <section title =' The "$id" keyword' >
390
+ <section title =' The "$id" keyword' anchor = " id-keyword " >
356
391
<t >
357
392
The "$id" keyword defines a URI for the schema,
358
393
and the base URI that other URI references within the schema are resolved against.
363
398
This value SHOULD be normalized, and SHOULD NOT be an empty fragment < #> or an empty string <> .
364
399
</t >
365
400
<t >
366
- The root schema of a JSON Schema document SHOULD contain an "$id" keyword with an absolute-URI (containing a scheme, but no fragment).
401
+ The root schema of a JSON Schema document SHOULD contain an "$id" keyword with
402
+ a URI (containing a scheme). This URI SHOULD either not have a fragment, or
403
+ have one that is an empty string.
404
+ <!-- All of the standard meta-schemas use an empty fragment in their id/$id values. -->
405
+ <cref >
406
+ How should an "$id" URI reference containing a fragement with other components
407
+ be interpreted? There are two cases: when the other components match
408
+ the current base URI and when they change the base URI.
409
+ </cref >
367
410
</t >
368
411
<t >
369
412
To name subschemas in a JSON Schema document,
370
413
subschemas can use "$id" to give themselves a document-local identifier.
371
- This form of "$id" keyword MUST begin with a hash ("#") to identify it as a fragment URI reference,
372
- followed by a letter ([A-Za-z]), followed by any number of
373
- letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), or periods (".").
374
- <!-- This restriction is the same one defined by XML -->
414
+ This is done by setting "$id" to a URI reference consisting only of a fragment.
415
+ The fragment identifier MUST begin with a letter ([A-Za-z]), followed by
416
+ any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), or periods (".").
417
+ </t >
418
+ <t >
419
+ The effect of defining an "$id" that neither matches the above
420
+ requirements nor is a valid JSON pointer is not defined.
375
421
</t >
376
422
<t >
377
423
For example:
401
447
<t >
402
448
The schemas at the following URI-encoded <xref target =" RFC6901" >JSON
403
449
Pointers</xref > (relative to the root schema) have the following
404
- base URIs, and are identifiable by either URI:
450
+ base URIs, and are identifiable by either URI in accordance with
451
+ Section <xref target =" fragments" format =" counter" ></xref > above:
405
452
</t >
406
453
<t >
407
454
<list style =" hanging" >
@@ -502,7 +549,7 @@ Link: <http://example.com/my-hyper-schema#>; rel="describedby"
502
549
</section >
503
550
504
551
505
- <section title =' Describing a profile of JSON' >
552
+ <section title =' Describing a profile of JSON' anchor = " profile " >
506
553
<t >
507
554
Instances MAY specify a "profile" as described in <xref target =" RFC6906" >The 'profile' Link Relation</xref >.
508
555
When used as a media-type parameter, HTTP servers gain the ability to perform Content-Type Negotiation based on profile.
@@ -581,7 +628,7 @@ User-Agent: so-cool-json-schema/1.0.2 curl/7.43.0
581
628
582
629
</section >
583
630
584
- <section title =" Security considerations" >
631
+ <section title =" Security considerations" anchor = " security " >
585
632
<t >
586
633
Both schemas and instances are JSON values. As such, all security considerations
587
634
defined in <xref target =" RFC7159" >RFC 7159</xref > apply.
@@ -604,8 +651,27 @@ User-Agent: so-cool-json-schema/1.0.2 curl/7.43.0
604
651
The proposed MIME media type for JSON Schema is defined as follows:
605
652
606
653
<list >
607
- <t >type name: application;</t >
608
- <t >subtype name: schema+json.</t >
654
+ <t >Type name: application</t >
655
+ <t >Subtype name: schema+json</t >
656
+ <t >Required parameters: N/A</t >
657
+ <t >
658
+ Encoding considerations: Encoding considerations are
659
+ identical to those specified for the "application/json"
660
+ media type. See <xref target =" RFC7159" >JSON</xref >.
661
+ </t >
662
+ <t >
663
+ Security considerations: See Section
664
+ <xref target =" security" format =" counter" ></xref > above.
665
+ </t >
666
+ <t >
667
+ Interoperability considerations: See Sections
668
+ <xref target =" language" format =" counter" ></xref > and
669
+ <xref target =" integers" format =" counter" ></xref > above.
670
+ </t >
671
+ <t >
672
+ Fragment identifier considerations: See Section
673
+ <xref target =" fragments" format =" counter" ></xref >
674
+ </t >
609
675
</list >
610
676
</t >
611
677
@@ -617,16 +683,18 @@ User-Agent: so-cool-json-schema/1.0.2 curl/7.43.0
617
683
<references title =" Normative References" >
618
684
&RFC2119;
619
685
&RFC3986;
686
+ &RFC6839;
687
+ &RFC6901;
620
688
&RFC7159;
621
689
&ldp;
622
690
</references >
623
691
624
692
<references title =" Informative References" >
625
693
&RFC5988;
626
- &RFC6901;
627
694
&RFC6906;
628
695
&RFC7049;
629
696
&RFC7231;
697
+ &fragid-best-practices;
630
698
<reference anchor =" json-schema-validation" >
631
699
<front >
632
700
<title >JSON Schema Validation: A Vocabulary for Structural Validation of JSON</title >
0 commit comments