forked from json-schema-org/json-schema-org.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjson-schema-validation.html
1305 lines (1237 loc) · 86.2 KB
/
json-schema-validation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head profile="http://www.w3.org/2006/03/hcard http://dublincore.org/documents/2008/08/04/dc-html/">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<title>JSON Schema Validation: A Vocabulary for Structural Validation of JSON </title>
<style type="text/css" title="Xml2Rfc (sans serif)">
/*<![CDATA[*/
a {
text-decoration: none;
}
/* info code from SantaKlauss at http://www.madaboutstyle.com/tooltip2.html */
a.info {
/* This is the key. */
position: relative;
z-index: 24;
text-decoration: none;
}
a.info:hover {
z-index: 25;
color: #FFF; background-color: #900;
}
a.info span { display: none; }
a.info:hover span.info {
/* The span will display just on :hover state. */
display: block;
position: absolute;
font-size: smaller;
top: 2em; left: -5em; width: 15em;
padding: 2px; border: 1px solid #333;
color: #900; background-color: #EEE;
text-align: left;
}
a.smpl {
color: black;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: underline;
}
address {
margin-top: 1em;
margin-left: 2em;
font-style: normal;
}
body {
color: black;
font-family: verdana, helvetica, arial, sans-serif;
font-size: 10pt;
max-width: 55em;
}
cite {
font-style: normal;
}
dd {
margin-right: 2em;
}
dl {
margin-left: 2em;
}
ul.empty {
list-style-type: none;
}
ul.empty li {
margin-top: .5em;
}
dl p {
margin-left: 0em;
}
dt {
margin-top: .5em;
}
h1 {
font-size: 14pt;
line-height: 21pt;
page-break-after: avoid;
}
h1.np {
page-break-before: always;
}
h1 a {
color: #333333;
}
h2 {
font-size: 12pt;
line-height: 15pt;
page-break-after: avoid;
}
h3, h4, h5, h6 {
font-size: 10pt;
page-break-after: avoid;
}
h2 a, h3 a, h4 a, h5 a, h6 a {
color: black;
}
img {
margin-left: 3em;
}
li {
margin-left: 2em;
margin-right: 2em;
}
ol {
margin-left: 2em;
margin-right: 2em;
}
ol p {
margin-left: 0em;
}
p {
margin-left: 2em;
margin-right: 2em;
}
pre {
margin-left: 3em;
background-color: lightyellow;
padding: .25em;
}
pre.text2 {
border-style: dotted;
border-width: 1px;
background-color: #f0f0f0;
width: 69em;
}
pre.inline {
background-color: white;
padding: 0em;
}
pre.text {
border-style: dotted;
border-width: 1px;
background-color: #f8f8f8;
width: 69em;
}
pre.drawing {
border-style: solid;
border-width: 1px;
background-color: #f8f8f8;
padding: 2em;
}
table {
margin-left: 2em;
}
table.tt {
vertical-align: top;
}
table.full {
border-style: outset;
border-width: 1px;
}
table.headers {
border-style: outset;
border-width: 1px;
}
table.tt td {
vertical-align: top;
}
table.full td {
border-style: inset;
border-width: 1px;
}
table.tt th {
vertical-align: top;
}
table.full th {
border-style: inset;
border-width: 1px;
}
table.headers th {
border-style: none none inset none;
border-width: 1px;
}
table.left {
margin-right: auto;
}
table.right {
margin-left: auto;
}
table.center {
margin-left: auto;
margin-right: auto;
}
caption {
caption-side: bottom;
font-weight: bold;
font-size: 9pt;
margin-top: .5em;
}
table.header {
border-spacing: 1px;
width: 95%;
font-size: 10pt;
color: white;
}
td.top {
vertical-align: top;
}
td.topnowrap {
vertical-align: top;
white-space: nowrap;
}
table.header td {
background-color: gray;
width: 50%;
}
table.header a {
color: white;
}
td.reference {
vertical-align: top;
white-space: nowrap;
padding-right: 1em;
}
thead {
display:table-header-group;
}
ul.toc, ul.toc ul {
list-style: none;
margin-left: 1.5em;
margin-right: 0em;
padding-left: 0em;
}
ul.toc li {
line-height: 150%;
font-weight: bold;
font-size: 10pt;
margin-left: 0em;
margin-right: 0em;
}
ul.toc li li {
line-height: normal;
font-weight: normal;
font-size: 9pt;
margin-left: 0em;
margin-right: 0em;
}
li.excluded {
font-size: 0pt;
}
ul p {
margin-left: 0em;
}
.comment {
background-color: yellow;
}
.center {
text-align: center;
}
.error {
color: red;
font-style: italic;
font-weight: bold;
}
.figure {
font-weight: bold;
text-align: center;
font-size: 9pt;
}
.filename {
color: #333333;
font-weight: bold;
font-size: 12pt;
line-height: 21pt;
text-align: center;
}
.fn {
font-weight: bold;
}
.hidden {
display: none;
}
.left {
text-align: left;
}
.right {
text-align: right;
}
.title {
color: #990000;
font-size: 18pt;
line-height: 18pt;
font-weight: bold;
text-align: center;
margin-top: 36pt;
}
.vcardline {
display: block;
}
.warning {
font-size: 14pt;
background-color: yellow;
}
@media print {
.noprint {
display: none;
}
a {
color: black;
text-decoration: none;
}
table.header {
width: 90%;
}
td.header {
width: 50%;
color: black;
background-color: white;
vertical-align: top;
font-size: 12pt;
}
ul.toc a::after {
content: leader('.') target-counter(attr(href), page);
}
ul.ind li li a {
content: target-counter(attr(href), page);
}
.print2col {
column-count: 2;
-moz-column-count: 2;
column-fill: auto;
}
}
@page {
@top-left {
content: "Internet-Draft";
}
@top-right {
content: "December 2010";
}
@top-center {
content: "Abbreviated Title";
}
@bottom-left {
content: "Doe";
}
@bottom-center {
content: "Expires June 2011";
}
@bottom-right {
content: "[Page " counter(page) "]";
}
}
@page:first {
@top-left {
content: normal;
}
@top-right {
content: normal;
}
@top-center {
content: normal;
}
}
/*]]>*/
</style>
<link href="#rfc.toc" rel="Contents"/>
<link href="#rfc.section.1" rel="Chapter" title="1 Introduction"/>
<link href="#rfc.section.2" rel="Chapter" title="2 Conventions and Terminology"/>
<link href="#rfc.section.3" rel="Chapter" title="3 Overview"/>
<link href="#rfc.section.3.1" rel="Chapter" title="3.1 Applicability"/>
<link href="#rfc.section.3.1.1" rel="Chapter" title="3.1.1 Keyword Independence"/>
<link href="#rfc.section.3.2" rel="Chapter" title="3.2 Assertions"/>
<link href="#rfc.section.3.2.1" rel="Chapter" title="3.2.1 Assertions and Instance Primitive Types"/>
<link href="#rfc.section.3.3" rel="Chapter" title="3.3 Annotations"/>
<link href="#rfc.section.3.3.1" rel="Chapter" title="3.3.1 Annotations and Validation Outcomes"/>
<link href="#rfc.section.3.3.2" rel="Chapter" title="3.3.2 Annotations and Short-Circuit Validation"/>
<link href="#rfc.section.4" rel="Chapter" title="4 Interoperability Considerations"/>
<link href="#rfc.section.4.1" rel="Chapter" title="4.1 Validation of String Instances"/>
<link href="#rfc.section.4.2" rel="Chapter" title="4.2 Validation of Numeric Instances"/>
<link href="#rfc.section.4.3" rel="Chapter" title="4.3 Regular Expressions"/>
<link href="#rfc.section.5" rel="Chapter" title="5 Meta-Schema"/>
<link href="#rfc.section.6" rel="Chapter" title="6 Validation Keywords"/>
<link href="#rfc.section.6.1" rel="Chapter" title="6.1 Validation Keywords for Any Instance Type"/>
<link href="#rfc.section.6.1.1" rel="Chapter" title="6.1.1 type"/>
<link href="#rfc.section.6.1.2" rel="Chapter" title="6.1.2 enum"/>
<link href="#rfc.section.6.1.3" rel="Chapter" title="6.1.3 const"/>
<link href="#rfc.section.6.2" rel="Chapter" title="6.2 Validation Keywords for Numeric Instances (number and integer)"/>
<link href="#rfc.section.6.2.1" rel="Chapter" title="6.2.1 multipleOf"/>
<link href="#rfc.section.6.2.2" rel="Chapter" title="6.2.2 maximum"/>
<link href="#rfc.section.6.2.3" rel="Chapter" title="6.2.3 exclusiveMaximum"/>
<link href="#rfc.section.6.2.4" rel="Chapter" title="6.2.4 minimum"/>
<link href="#rfc.section.6.2.5" rel="Chapter" title="6.2.5 exclusiveMinimum"/>
<link href="#rfc.section.6.3" rel="Chapter" title="6.3 Validation Keywords for Strings"/>
<link href="#rfc.section.6.3.1" rel="Chapter" title="6.3.1 maxLength"/>
<link href="#rfc.section.6.3.2" rel="Chapter" title="6.3.2 minLength"/>
<link href="#rfc.section.6.3.3" rel="Chapter" title="6.3.3 pattern"/>
<link href="#rfc.section.6.4" rel="Chapter" title="6.4 Validation Keywords for Arrays"/>
<link href="#rfc.section.6.4.1" rel="Chapter" title="6.4.1 items"/>
<link href="#rfc.section.6.4.2" rel="Chapter" title="6.4.2 additionalItems"/>
<link href="#rfc.section.6.4.3" rel="Chapter" title="6.4.3 maxItems"/>
<link href="#rfc.section.6.4.4" rel="Chapter" title="6.4.4 minItems"/>
<link href="#rfc.section.6.4.5" rel="Chapter" title="6.4.5 uniqueItems"/>
<link href="#rfc.section.6.4.6" rel="Chapter" title="6.4.6 contains"/>
<link href="#rfc.section.6.5" rel="Chapter" title="6.5 Validation Keywords for Objects"/>
<link href="#rfc.section.6.5.1" rel="Chapter" title="6.5.1 maxProperties"/>
<link href="#rfc.section.6.5.2" rel="Chapter" title="6.5.2 minProperties"/>
<link href="#rfc.section.6.5.3" rel="Chapter" title="6.5.3 required"/>
<link href="#rfc.section.6.5.4" rel="Chapter" title="6.5.4 properties"/>
<link href="#rfc.section.6.5.5" rel="Chapter" title="6.5.5 patternProperties"/>
<link href="#rfc.section.6.5.6" rel="Chapter" title="6.5.6 additionalProperties"/>
<link href="#rfc.section.6.5.7" rel="Chapter" title="6.5.7 dependencies"/>
<link href="#rfc.section.6.5.8" rel="Chapter" title="6.5.8 propertyNames"/>
<link href="#rfc.section.6.6" rel="Chapter" title="6.6 Keywords for Applying Subschemas Conditionally"/>
<link href="#rfc.section.6.6.1" rel="Chapter" title="6.6.1 if"/>
<link href="#rfc.section.6.6.2" rel="Chapter" title="6.6.2 then"/>
<link href="#rfc.section.6.6.3" rel="Chapter" title="6.6.3 else"/>
<link href="#rfc.section.6.7" rel="Chapter" title="6.7 Keywords for Applying Subschemas With Boolean Logic"/>
<link href="#rfc.section.6.7.1" rel="Chapter" title="6.7.1 allOf"/>
<link href="#rfc.section.6.7.2" rel="Chapter" title="6.7.2 anyOf"/>
<link href="#rfc.section.6.7.3" rel="Chapter" title="6.7.3 oneOf"/>
<link href="#rfc.section.6.7.4" rel="Chapter" title="6.7.4 not"/>
<link href="#rfc.section.7" rel="Chapter" title="7 Semantic Validation With "format""/>
<link href="#rfc.section.7.1" rel="Chapter" title="7.1 Foreword"/>
<link href="#rfc.section.7.2" rel="Chapter" title="7.2 Implementation Requirements"/>
<link href="#rfc.section.7.3" rel="Chapter" title="7.3 Defined Formats"/>
<link href="#rfc.section.7.3.1" rel="Chapter" title="7.3.1 Dates and Times"/>
<link href="#rfc.section.7.3.2" rel="Chapter" title="7.3.2 Email Addresses"/>
<link href="#rfc.section.7.3.3" rel="Chapter" title="7.3.3 Hostnames"/>
<link href="#rfc.section.7.3.4" rel="Chapter" title="7.3.4 IP Addresses"/>
<link href="#rfc.section.7.3.5" rel="Chapter" title="7.3.5 Resource Identifiers"/>
<link href="#rfc.section.7.3.6" rel="Chapter" title="7.3.6 uri-template"/>
<link href="#rfc.section.7.3.7" rel="Chapter" title="7.3.7 JSON Pointers"/>
<link href="#rfc.section.7.3.8" rel="Chapter" title="7.3.8 regex"/>
<link href="#rfc.section.8" rel="Chapter" title="8 String-Encoding Non-JSON Data"/>
<link href="#rfc.section.8.1" rel="Chapter" title="8.1 Foreword"/>
<link href="#rfc.section.8.2" rel="Chapter" title="8.2 Implementation Requirements"/>
<link href="#rfc.section.8.3" rel="Chapter" title="8.3 contentEncoding"/>
<link href="#rfc.section.8.4" rel="Chapter" title="8.4 contentMediaType"/>
<link href="#rfc.section.8.5" rel="Chapter" title="8.5 Example"/>
<link href="#rfc.section.9" rel="Chapter" title="9 Schema Re-Use With "definitions""/>
<link href="#rfc.section.10" rel="Chapter" title="10 Schema Annotations"/>
<link href="#rfc.section.10.1" rel="Chapter" title="10.1 "title" and "description""/>
<link href="#rfc.section.10.2" rel="Chapter" title="10.2 "default""/>
<link href="#rfc.section.10.3" rel="Chapter" title="10.3 "readOnly" and "writeOnly""/>
<link href="#rfc.section.10.4" rel="Chapter" title="10.4 "examples""/>
<link href="#rfc.section.11" rel="Chapter" title="11 Security Considerations"/>
<link href="#rfc.references" rel="Chapter" title="12 References"/>
<link href="#rfc.references.1" rel="Chapter" title="12.1 Normative References"/>
<link href="#rfc.references.2" rel="Chapter" title="12.2 Informative References"/>
<link href="#rfc.appendix.A" rel="Chapter" title="A Acknowledgments"/>
<link href="#rfc.appendix.B" rel="Chapter" title="B ChangeLog"/>
<link href="#rfc.authors" rel="Chapter"/>
<meta name="generator" content="xml2rfc version 2.5.1 - http://tools.ietf.org/tools/xml2rfc" />
<link rel="schema.dct" href="http://purl.org/dc/terms/" />
<meta name="dct.creator" content="Wright, A., Ed., Andrews, H., Ed., and G. Luff" />
<meta name="dct.identifier" content="urn:ietf:id:draft-handrews-json-schema-validation-01" />
<meta name="dct.issued" scheme="ISO8601" content="2018-3-19" />
<meta name="dct.abstract" content="JSON Schema (application/schema+json) has several purposes, one of which is JSON instance validation. This document specifies a vocabulary for JSON Schema to describe the meaning of JSON documents, provide hints for user interfaces working with JSON data, and to make assertions about what a valid document must look like. " />
<meta name="description" content="JSON Schema (application/schema+json) has several purposes, one of which is JSON instance validation. This document specifies a vocabulary for JSON Schema to describe the meaning of JSON documents, provide hints for user interfaces working with JSON data, and to make assertions about what a valid document must look like. " />
</head>
<body>
<table class="header">
<tbody>
<tr>
<td class="left">Internet Engineering Task Force</td>
<td class="right">A. Wright, Ed.</td>
</tr>
<tr>
<td class="left">Internet-Draft</td>
<td class="right"></td>
</tr>
<tr>
<td class="left">Intended status: Informational</td>
<td class="right">H. Andrews, Ed.</td>
</tr>
<tr>
<td class="left">Expires: September 20, 2018</td>
<td class="right">Cloudflare, Inc.</td>
</tr>
<tr>
<td class="left"></td>
<td class="right">G. Luff</td>
</tr>
<tr>
<td class="left"></td>
<td class="right">March 19, 2018</td>
</tr>
</tbody>
</table>
<p class="title">JSON Schema Validation: A Vocabulary for Structural Validation of JSON <br />
<span class="filename">draft-handrews-json-schema-validation-01</span></p>
<h1 id="rfc.abstract">
<a href="#rfc.abstract">Abstract</a>
</h1>
<p>JSON Schema (application/schema+json) has several purposes, one of which is JSON instance validation. This document specifies a vocabulary for JSON Schema to describe the meaning of JSON documents, provide hints for user interfaces working with JSON data, and to make assertions about what a valid document must look like. </p>
<h1>
<a>Note to Readers</a>
</h1>
<p>The issues list for this draft can be found at <span><</span><a href="https://github.com/json-schema-org/json-schema-spec/issues">https://github.com/json-schema-org/json-schema-spec/issues</a><span>></span>. </p>
<p>For additional information, see <span><</span><a href="http://json-schema.org/">http://json-schema.org/</a><span>></span>. </p>
<p>To provide feedback, use this issue tracker, the communication methods listed on the homepage, or email the document editors. </p>
<h1 id="rfc.status">
<a href="#rfc.status">Status of This Memo</a>
</h1>
<p>This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.</p>
<p>Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.</p>
<p>Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."</p>
<p>This Internet-Draft will expire on September 20, 2018.</p>
<h1 id="rfc.copyrightnotice">
<a href="#rfc.copyrightnotice">Copyright Notice</a>
</h1>
<p>Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved.</p>
<p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.</p>
<hr class="noprint" />
<h1 class="np" id="rfc.toc"><a href="#rfc.toc">Table of Contents</a></h1>
<ul class="toc">
<li>1. <a href="#rfc.section.1">Introduction</a></li>
<li>2. <a href="#rfc.section.2">Conventions and Terminology</a></li>
<li>3. <a href="#rfc.section.3">Overview</a></li>
<ul><li>3.1. <a href="#rfc.section.3.1">Applicability</a></li>
<ul><li>3.1.1. <a href="#rfc.section.3.1.1">Keyword Independence</a></li>
</ul><li>3.2. <a href="#rfc.section.3.2">Assertions</a></li>
<ul><li>3.2.1. <a href="#rfc.section.3.2.1">Assertions and Instance Primitive Types</a></li>
</ul><li>3.3. <a href="#rfc.section.3.3">Annotations</a></li>
<ul><li>3.3.1. <a href="#rfc.section.3.3.1">Annotations and Validation Outcomes</a></li>
<li>3.3.2. <a href="#rfc.section.3.3.2">Annotations and Short-Circuit Validation</a></li>
</ul></ul><li>4. <a href="#rfc.section.4">Interoperability Considerations</a></li>
<ul><li>4.1. <a href="#rfc.section.4.1">Validation of String Instances</a></li>
<li>4.2. <a href="#rfc.section.4.2">Validation of Numeric Instances</a></li>
<li>4.3. <a href="#rfc.section.4.3">Regular Expressions</a></li>
</ul><li>5. <a href="#rfc.section.5">Meta-Schema</a></li>
<li>6. <a href="#rfc.section.6">Validation Keywords</a></li>
<ul><li>6.1. <a href="#rfc.section.6.1">Validation Keywords for Any Instance Type</a></li>
<ul><li>6.1.1. <a href="#rfc.section.6.1.1">type</a></li>
<li>6.1.2. <a href="#rfc.section.6.1.2">enum</a></li>
<li>6.1.3. <a href="#rfc.section.6.1.3">const</a></li>
</ul><li>6.2. <a href="#rfc.section.6.2">Validation Keywords for Numeric Instances (number and integer)</a></li>
<ul><li>6.2.1. <a href="#rfc.section.6.2.1">multipleOf</a></li>
<li>6.2.2. <a href="#rfc.section.6.2.2">maximum</a></li>
<li>6.2.3. <a href="#rfc.section.6.2.3">exclusiveMaximum</a></li>
<li>6.2.4. <a href="#rfc.section.6.2.4">minimum</a></li>
<li>6.2.5. <a href="#rfc.section.6.2.5">exclusiveMinimum</a></li>
</ul><li>6.3. <a href="#rfc.section.6.3">Validation Keywords for Strings</a></li>
<ul><li>6.3.1. <a href="#rfc.section.6.3.1">maxLength</a></li>
<li>6.3.2. <a href="#rfc.section.6.3.2">minLength</a></li>
<li>6.3.3. <a href="#rfc.section.6.3.3">pattern</a></li>
</ul><li>6.4. <a href="#rfc.section.6.4">Validation Keywords for Arrays</a></li>
<ul><li>6.4.1. <a href="#rfc.section.6.4.1">items</a></li>
<li>6.4.2. <a href="#rfc.section.6.4.2">additionalItems</a></li>
<li>6.4.3. <a href="#rfc.section.6.4.3">maxItems</a></li>
<li>6.4.4. <a href="#rfc.section.6.4.4">minItems</a></li>
<li>6.4.5. <a href="#rfc.section.6.4.5">uniqueItems</a></li>
<li>6.4.6. <a href="#rfc.section.6.4.6">contains</a></li>
</ul><li>6.5. <a href="#rfc.section.6.5">Validation Keywords for Objects</a></li>
<ul><li>6.5.1. <a href="#rfc.section.6.5.1">maxProperties</a></li>
<li>6.5.2. <a href="#rfc.section.6.5.2">minProperties</a></li>
<li>6.5.3. <a href="#rfc.section.6.5.3">required</a></li>
<li>6.5.4. <a href="#rfc.section.6.5.4">properties</a></li>
<li>6.5.5. <a href="#rfc.section.6.5.5">patternProperties</a></li>
<li>6.5.6. <a href="#rfc.section.6.5.6">additionalProperties</a></li>
<li>6.5.7. <a href="#rfc.section.6.5.7">dependencies</a></li>
<li>6.5.8. <a href="#rfc.section.6.5.8">propertyNames</a></li>
</ul><li>6.6. <a href="#rfc.section.6.6">Keywords for Applying Subschemas Conditionally</a></li>
<ul><li>6.6.1. <a href="#rfc.section.6.6.1">if</a></li>
<li>6.6.2. <a href="#rfc.section.6.6.2">then</a></li>
<li>6.6.3. <a href="#rfc.section.6.6.3">else</a></li>
</ul><li>6.7. <a href="#rfc.section.6.7">Keywords for Applying Subschemas With Boolean Logic</a></li>
<ul><li>6.7.1. <a href="#rfc.section.6.7.1">allOf</a></li>
<li>6.7.2. <a href="#rfc.section.6.7.2">anyOf</a></li>
<li>6.7.3. <a href="#rfc.section.6.7.3">oneOf</a></li>
<li>6.7.4. <a href="#rfc.section.6.7.4">not</a></li>
</ul></ul><li>7. <a href="#rfc.section.7">Semantic Validation With "format"</a></li>
<ul><li>7.1. <a href="#rfc.section.7.1">Foreword</a></li>
<li>7.2. <a href="#rfc.section.7.2">Implementation Requirements</a></li>
<li>7.3. <a href="#rfc.section.7.3">Defined Formats</a></li>
<ul><li>7.3.1. <a href="#rfc.section.7.3.1">Dates and Times</a></li>
<li>7.3.2. <a href="#rfc.section.7.3.2">Email Addresses</a></li>
<li>7.3.3. <a href="#rfc.section.7.3.3">Hostnames</a></li>
<li>7.3.4. <a href="#rfc.section.7.3.4">IP Addresses</a></li>
<li>7.3.5. <a href="#rfc.section.7.3.5">Resource Identifiers</a></li>
<li>7.3.6. <a href="#rfc.section.7.3.6">uri-template</a></li>
<li>7.3.7. <a href="#rfc.section.7.3.7">JSON Pointers</a></li>
<li>7.3.8. <a href="#rfc.section.7.3.8">regex</a></li>
</ul></ul><li>8. <a href="#rfc.section.8">String-Encoding Non-JSON Data</a></li>
<ul><li>8.1. <a href="#rfc.section.8.1">Foreword</a></li>
<li>8.2. <a href="#rfc.section.8.2">Implementation Requirements</a></li>
<li>8.3. <a href="#rfc.section.8.3">contentEncoding</a></li>
<li>8.4. <a href="#rfc.section.8.4">contentMediaType</a></li>
<li>8.5. <a href="#rfc.section.8.5">Example</a></li>
</ul><li>9. <a href="#rfc.section.9">Schema Re-Use With "definitions"</a></li>
<li>10. <a href="#rfc.section.10">Schema Annotations</a></li>
<ul><li>10.1. <a href="#rfc.section.10.1">"title" and "description"</a></li>
<li>10.2. <a href="#rfc.section.10.2">"default"</a></li>
<li>10.3. <a href="#rfc.section.10.3">"readOnly" and "writeOnly"</a></li>
<li>10.4. <a href="#rfc.section.10.4">"examples"</a></li>
</ul><li>11. <a href="#rfc.section.11">Security Considerations</a></li>
<li>12. <a href="#rfc.references">References</a></li>
<ul><li>12.1. <a href="#rfc.references.1">Normative References</a></li>
<li>12.2. <a href="#rfc.references.2">Informative References</a></li>
</ul><li>Appendix A. <a href="#rfc.appendix.A">Acknowledgments</a></li>
<li>Appendix B. <a href="#rfc.appendix.B">ChangeLog</a></li>
<li><a href="#rfc.authors">Authors' Addresses</a></li>
</ul>
<h1 id="rfc.section.1"><a href="#rfc.section.1">1.</a> Introduction</h1>
<p id="rfc.section.1.p.1">JSON Schema can be used to require that a given JSON document (an instance) satisfies a certain number of criteria. These criteria are asserted by using keywords described in this specification. In addition, a set of keywords is also defined to assist in interactive user interface instance generation. </p>
<p id="rfc.section.1.p.2">This specification will use the concepts, syntax, and terminology defined by the <a href="#json-schema">JSON Schema core</a> <cite title="NONE">[json-schema]</cite> specification. </p>
<h1 id="rfc.section.2"><a href="#rfc.section.2">2.</a> Conventions and Terminology</h1>
<p id="rfc.section.2.p.1">The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <a href="#RFC2119">RFC 2119</a> <cite title="NONE">[RFC2119]</cite>. </p>
<p id="rfc.section.2.p.2">This specification uses the term "container instance" to refer to both array and object instances. It uses the term "children instances" to refer to array elements or object member values. </p>
<p id="rfc.section.2.p.3">Elements in an array value are said to be unique if no two elements of this array are <a href="#json-schema">equal</a> <cite title="NONE">[json-schema]</cite>. </p>
<h1 id="rfc.section.3"><a href="#rfc.section.3">3.</a> Overview</h1>
<p id="rfc.section.3.p.1">JSON Schema validation applies schemas to locations within the instance, and asserts constraints on the structure of the data at each location. An instance location that satisfies all asserted constraints is then annotated with any keywords that contain non-assertion information, such as descriptive metadata and usage hints. If all locations within the instance satisfy all asserted constraints, then the instance is said to be valid against the schema. </p>
<p id="rfc.section.3.p.2">Each schema object is independently evaluated against each instance location to which it applies. This greatly simplifies the implementation requirements for validators by ensuring that they do not need to maintain state across the document-wide validation process. </p>
<h1 id="rfc.section.3.1"><a href="#rfc.section.3.1">3.1.</a> Applicability</h1>
<p id="rfc.section.3.1.p.1">Validation begins by applying the root schema to the complete instance document. From there, various keywords are used to determine which additional subschemas are applied to either the current location, or a child location. These keywords also define whether and how subschema assertion results are modified and/or combined. Such keywords do not assert conditions on their own. Rather, they control how assertions are applied and evaluated. </p>
<p id="rfc.section.3.1.p.2">The keywords in the <a href="#logic">boolean logic</a> <cite title="NONE">[logic]</cite> and <a href="#conditional">conditional</a> <cite title="NONE">[conditional]</cite> sections of this specification apply subschemas to the same location as the parent schema. The former group defines boolean operations on the subschema assertion results, while the latter evaluates one subschema and uses its assertion results to determine which of two other subschemas to apply as well. </p>
<p id="rfc.section.3.1.p.3">Several keywords determine which subschemas are applied to array items, object property values, and object property names. They are: "items", "additionalItems", "contains", "properties", "patternProperties", "additionalProperties", and "propertyNames". The "contains" keyword only requires its subschema to be valid against at least one child instance, while the other keywords require that all subschemas are valid against all child instances to which they apply. </p>
<h1 id="rfc.section.3.1.1"><a href="#rfc.section.3.1.1">3.1.1.</a> Keyword Independence</h1>
<p id="rfc.section.3.1.1.p.1">Validation keywords typically operate independently, without affecting each other's outcomes. </p>
<p id="rfc.section.3.1.1.p.2">For schema author convenience, there are some exceptions among the keywords that control subschema applicability: </p>
<ul class="empty">
<li>"additionalProperties", whose behavior is defined in terms of "properties" and "patternProperties"; and </li>
<li>"additionalItems", whose behavior is defined in terms of "items". </li>
</ul>
<p> </p>
<h1 id="rfc.section.3.2"><a href="#rfc.section.3.2">3.2.</a> <a href="#assertions" id="assertions">Assertions</a></h1>
<p id="rfc.section.3.2.p.1">Validation is a process of checking assertions. Each assertion adds constraints that an instance must satisfy in order to successfully validate. </p>
<p id="rfc.section.3.2.p.2">Assertion keywords that are absent never restrict validation. In some cases, this no-op behavior is identical to a keyword that exists with certain values, and these values are noted where known. </p>
<p id="rfc.section.3.2.p.3">All of the keywords in the <a href="#general">general</a> <cite title="NONE">[general]</cite>, <a href="#numeric">numeric</a> <cite title="NONE">[numeric]</cite>, and <a href="#string">string</a> <cite title="NONE">[string]</cite> sections are assertions, as well as "minItems", "maxItems", "uniqueItems", "minProperties", "maxProperties", and "required". Additionally, "dependencies" is shorthand for a combination of conditional and assertion keywords. </p>
<p id="rfc.section.3.2.p.4">The "format", "contentType", and "contentEncoding" keywords can also be implemented as assertions, although that functionality is an optional part of this specification, and the keywords convey additional non-assertion information. </p>
<h1 id="rfc.section.3.2.1"><a href="#rfc.section.3.2.1">3.2.1.</a> Assertions and Instance Primitive Types</h1>
<p id="rfc.section.3.2.1.p.1">Most validation assertions only constrain values within a certain primitive type. When the type of the instance is not of the type targeted by the keyword, the instance is considered to conform to the assertion. </p>
<p id="rfc.section.3.2.1.p.2">For example, the "maxLength" keyword will only restrict certain strings (that are too long) from being valid. If the instance is a number, boolean, null, array, or object, then it is valid against this assertion. </p>
<h1 id="rfc.section.3.3"><a href="#rfc.section.3.3">3.3.</a> <a href="#annotations" id="annotations">Annotations</a></h1>
<p id="rfc.section.3.3.p.1">In addition to assertions, this specification provides a small vocabulary of metadata keywords that can be used to annotate the JSON instance with useful information. The <a href="#format">Section 7</a> and <a href="#content">Section 8</a> keywords are also useful as annotations as well as being optional assertions, as they convey additional usage guidance for the instance data. </p>
<p id="rfc.section.3.3.p.2">A schema that is applicable to a particular location in the instance, against which the instance location is valid, attaches its annotations to that location in the instance. Since many subschemas can be applicable to any single location, annotation keywords need to specify any unusual handling of multiple applicable occurrences of the keyword with different values. The default behavior is simply to collect all values. </p>
<p id="rfc.section.3.3.p.3">Additional vocabularies SHOULD make use of this mechanism for applying their own annotations to instances. </p>
<h1 id="rfc.section.3.3.1"><a href="#rfc.section.3.3.1">3.3.1.</a> Annotations and Validation Outcomes</h1>
<p id="rfc.section.3.3.1.p.1">Annotations are collected whenever an instance is valid against a schema object, and all of that schema object's parent schemas. </p>
<p id="rfc.section.3.3.1.p.2">In particular, annotations in a subschema contained within a "not", at any depth, including any number of intervening additional "not" subschemas, MUST be ignored. If the instance was valid against the "not" subschema, then by definition it is not valid against the schema that contains the "not", so the "not" subschema's annotations are not used. </p>
<p id="rfc.section.3.3.1.p.3">Similarly, annotations within a failing branch of a "oneOf", "anyOf", "then", or "else" MUST be ignored even when the instance successfully validates against the complete schema document. </p>
<h1 id="rfc.section.3.3.2"><a href="#rfc.section.3.3.2">3.3.2.</a> Annotations and Short-Circuit Validation</h1>
<p id="rfc.section.3.3.2.p.1">Annotation keywords MUST be applied to all possible sub-instances. Even if such application can be short-circuited when only assertion evaluation is needed. For instance, the "contains" keyword need only be checked for assertions until at least one array item proves valid. However, when working with annotations, all items in the array must be evaluated to determine all items with which the annotations should be associated. </p>
<h1 id="rfc.section.4"><a href="#rfc.section.4">4.</a> Interoperability Considerations</h1>
<h1 id="rfc.section.4.1"><a href="#rfc.section.4.1">4.1.</a> Validation of String Instances</h1>
<p id="rfc.section.4.1.p.1">It should be noted that the nul character (\u0000) is valid in a JSON string. An instance to validate may contain a string value with this character, regardless of the ability of the underlying programming language to deal with such data. </p>
<h1 id="rfc.section.4.2"><a href="#rfc.section.4.2">4.2.</a> Validation of Numeric Instances</h1>
<p id="rfc.section.4.2.p.1">The JSON specification allows numbers with arbitrary precision, and JSON Schema does not add any such bounds. This means that numeric instances processed by JSON Schema can be arbitrarily large and/or have an arbitrarily long decimal part, regardless of the ability of the underlying programming language to deal with such data. </p>
<h1 id="rfc.section.4.3"><a href="#rfc.section.4.3">4.3.</a> <a href="#regexInterop" id="regexInterop">Regular Expressions</a></h1>
<p id="rfc.section.4.3.p.1">Two validation keywords, "pattern" and "patternProperties", use regular expressions to express constraints, and the "regex" value for the "format" keyword constrains the instance value to be a regular expression. These regular expressions SHOULD be valid according to the <a href="#ecma262">ECMA 262</a> <cite title="NONE">[ecma262]</cite> regular expression dialect. </p>
<p id="rfc.section.4.3.p.2">Furthermore, given the high disparity in regular expression constructs support, schema authors SHOULD limit themselves to the following regular expression tokens: </p>
<ul class="empty">
<li>individual Unicode characters, as defined by the <a href="#RFC7159">JSON specification</a> <cite title="NONE">[RFC7159]</cite>;</li>
<li>simple character classes ([abc]), range character classes ([a-z]);</li>
<li>complemented character classes ([^abc], [^a-z]);</li>
<li>simple quantifiers: "+" (one or more), "*" (zero or more), "?" (zero or one), and their lazy versions ("+?", "*?", "??");</li>
<li>range quantifiers: "{x}" (exactly x occurrences), "{x,y}" (at least x, at most y, occurrences), {x,} (x occurrences or more), and their lazy versions;</li>
<li>the beginning-of-input ("^") and end-of-input ("$") anchors;</li>
<li>simple grouping ("(...)") and alternation ("|").</li>
</ul>
<p> </p>
<p id="rfc.section.4.3.p.3">Finally, implementations MUST NOT take regular expressions to be anchored, neither at the beginning nor at the end. This means, for instance, the pattern "es" matches "expression". </p>
<h1 id="rfc.section.5"><a href="#rfc.section.5">5.</a> Meta-Schema</h1>
<p id="rfc.section.5.p.1">The current URI for the JSON Schema Validation is <span><</span><a href="http://json-schema.org/draft-07/schema#">http://json-schema.org/draft-07/schema#</a><span>></span>. </p>
<h1 id="rfc.section.6"><a href="#rfc.section.6">6.</a> Validation Keywords</h1>
<p id="rfc.section.6.p.1">Validation keywords in a schema impose requirements for successful validation of an instance. </p>
<h1 id="rfc.section.6.1"><a href="#rfc.section.6.1">6.1.</a> <a href="#general" id="general">Validation Keywords for Any Instance Type</a></h1>
<h1 id="rfc.section.6.1.1"><a href="#rfc.section.6.1.1">6.1.1.</a> type</h1>
<p id="rfc.section.6.1.1.p.1">The value of this keyword MUST be either a string or an array. If it is an array, elements of the array MUST be strings and MUST be unique. </p>
<p id="rfc.section.6.1.1.p.2">String values MUST be one of the six primitive types ("null", "boolean", "object", "array", "number", or "string"), or "integer" which matches any number with a zero fractional part. </p>
<p id="rfc.section.6.1.1.p.3">An instance validates if and only if the instance is in any of the sets listed for this keyword. </p>
<h1 id="rfc.section.6.1.2"><a href="#rfc.section.6.1.2">6.1.2.</a> enum</h1>
<p id="rfc.section.6.1.2.p.1">The value of this keyword MUST be an array. This array SHOULD have at least one element. Elements in the array SHOULD be unique. </p>
<p id="rfc.section.6.1.2.p.2">An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value. </p>
<p id="rfc.section.6.1.2.p.3">Elements in the array might be of any value, including null. </p>
<h1 id="rfc.section.6.1.3"><a href="#rfc.section.6.1.3">6.1.3.</a> const</h1>
<p id="rfc.section.6.1.3.p.1">The value of this keyword MAY be of any type, including null. </p>
<p id="rfc.section.6.1.3.p.2">An instance validates successfully against this keyword if its value is equal to the value of the keyword. </p>
<h1 id="rfc.section.6.2"><a href="#rfc.section.6.2">6.2.</a> <a href="#numeric" id="numeric">Validation Keywords for Numeric Instances (number and integer)</a></h1>
<h1 id="rfc.section.6.2.1"><a href="#rfc.section.6.2.1">6.2.1.</a> multipleOf</h1>
<p id="rfc.section.6.2.1.p.1">The value of "multipleOf" MUST be a number, strictly greater than 0. </p>
<p id="rfc.section.6.2.1.p.2">A numeric instance is valid only if division by this keyword's value results in an integer. </p>
<h1 id="rfc.section.6.2.2"><a href="#rfc.section.6.2.2">6.2.2.</a> maximum</h1>
<p id="rfc.section.6.2.2.p.1">The value of "maximum" MUST be a number, representing an inclusive upper limit for a numeric instance. </p>
<p id="rfc.section.6.2.2.p.2">If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to "maximum". </p>
<h1 id="rfc.section.6.2.3"><a href="#rfc.section.6.2.3">6.2.3.</a> exclusiveMaximum</h1>
<p id="rfc.section.6.2.3.p.1">The value of "exclusiveMaximum" MUST be number, representing an exclusive upper limit for a numeric instance. </p>
<p id="rfc.section.6.2.3.p.2">If the instance is a number, then the instance is valid only if it has a value strictly less than (not equal to) "exclusiveMaximum". </p>
<h1 id="rfc.section.6.2.4"><a href="#rfc.section.6.2.4">6.2.4.</a> minimum</h1>
<p id="rfc.section.6.2.4.p.1">The value of "minimum" MUST be a number, representing an inclusive lower limit for a numeric instance. </p>
<p id="rfc.section.6.2.4.p.2">If the instance is a number, then this keyword validates only if the instance is greater than or exactly equal to "minimum". </p>
<h1 id="rfc.section.6.2.5"><a href="#rfc.section.6.2.5">6.2.5.</a> exclusiveMinimum</h1>
<p id="rfc.section.6.2.5.p.1">The value of "exclusiveMinimum" MUST be number, representing an exclusive lower limit for a numeric instance. </p>
<p id="rfc.section.6.2.5.p.2">If the instance is a number, then the instance is valid only if it has a value strictly greater than (not equal to) "exclusiveMinimum". </p>
<h1 id="rfc.section.6.3"><a href="#rfc.section.6.3">6.3.</a> <a href="#string" id="string">Validation Keywords for Strings</a></h1>
<h1 id="rfc.section.6.3.1"><a href="#rfc.section.6.3.1">6.3.1.</a> maxLength</h1>
<p id="rfc.section.6.3.1.p.1">The value of this keyword MUST be a non-negative integer.</p>
<p id="rfc.section.6.3.1.p.2">A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. </p>
<p id="rfc.section.6.3.1.p.3">The length of a string instance is defined as the number of its characters as defined by <a href="#RFC7159">RFC 7159</a> <cite title="NONE">[RFC7159]</cite>. </p>
<h1 id="rfc.section.6.3.2"><a href="#rfc.section.6.3.2">6.3.2.</a> minLength</h1>
<p id="rfc.section.6.3.2.p.1">The value of this keyword MUST be a non-negative integer. </p>
<p id="rfc.section.6.3.2.p.2">A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. </p>
<p id="rfc.section.6.3.2.p.3">The length of a string instance is defined as the number of its characters as defined by <a href="#RFC7159">RFC 7159</a> <cite title="NONE">[RFC7159]</cite>. </p>
<p id="rfc.section.6.3.2.p.4">Omitting this keyword has the same behavior as a value of 0. </p>
<h1 id="rfc.section.6.3.3"><a href="#rfc.section.6.3.3">6.3.3.</a> pattern</h1>
<p id="rfc.section.6.3.3.p.1">The value of this keyword MUST be a string. This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. </p>
<p id="rfc.section.6.3.3.p.2">A string instance is considered valid if the regular expression matches the instance successfully. Recall: regular expressions are not implicitly anchored. </p>
<h1 id="rfc.section.6.4"><a href="#rfc.section.6.4">6.4.</a> Validation Keywords for Arrays</h1>
<h1 id="rfc.section.6.4.1"><a href="#rfc.section.6.4.1">6.4.1.</a> items</h1>
<p id="rfc.section.6.4.1.p.1">The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas. </p>
<p id="rfc.section.6.4.1.p.2">This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. </p>
<p id="rfc.section.6.4.1.p.3">If "items" is a schema, validation succeeds if all elements in the array successfully validate against that schema. </p>
<p id="rfc.section.6.4.1.p.4">If "items" is an array of schemas, validation succeeds if each element of the instance validates against the schema at the same position, if any. </p>
<p id="rfc.section.6.4.1.p.5">Omitting this keyword has the same behavior as an empty schema. </p>
<h1 id="rfc.section.6.4.2"><a href="#rfc.section.6.4.2">6.4.2.</a> additionalItems</h1>
<p id="rfc.section.6.4.2.p.1">The value of "additionalItems" MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.4.2.p.2">This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. </p>
<p id="rfc.section.6.4.2.p.3">If "items" is an array of schemas, validation succeeds if every instance element at a position greater than the size of "items" validates against "additionalItems". </p>
<p id="rfc.section.6.4.2.p.4">Otherwise, "additionalItems" MUST be ignored, as the "items" schema (possibly the default value of an empty schema) is applied to all elements. </p>
<p id="rfc.section.6.4.2.p.5">Omitting this keyword has the same behavior as an empty schema. </p>
<h1 id="rfc.section.6.4.3"><a href="#rfc.section.6.4.3">6.4.3.</a> maxItems</h1>
<p id="rfc.section.6.4.3.p.1">The value of this keyword MUST be a non-negative integer. </p>
<p id="rfc.section.6.4.3.p.2">An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. </p>
<h1 id="rfc.section.6.4.4"><a href="#rfc.section.6.4.4">6.4.4.</a> minItems</h1>
<p id="rfc.section.6.4.4.p.1">The value of this keyword MUST be a non-negative integer. </p>
<p id="rfc.section.6.4.4.p.2">An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword. </p>
<p id="rfc.section.6.4.4.p.3">Omitting this keyword has the same behavior as a value of 0. </p>
<h1 id="rfc.section.6.4.5"><a href="#rfc.section.6.4.5">6.4.5.</a> uniqueItems</h1>
<p id="rfc.section.6.4.5.p.1">The value of this keyword MUST be a boolean. </p>
<p id="rfc.section.6.4.5.p.2">If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique. </p>
<p id="rfc.section.6.4.5.p.3">Omitting this keyword has the same behavior as a value of false. </p>
<h1 id="rfc.section.6.4.6"><a href="#rfc.section.6.4.6">6.4.6.</a> contains</h1>
<p id="rfc.section.6.4.6.p.1">The value of this keyword MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.4.6.p.2">An array instance is valid against "contains" if at least one of its elements is valid against the given schema. </p>
<h1 id="rfc.section.6.5"><a href="#rfc.section.6.5">6.5.</a> Validation Keywords for Objects</h1>
<h1 id="rfc.section.6.5.1"><a href="#rfc.section.6.5.1">6.5.1.</a> maxProperties</h1>
<p id="rfc.section.6.5.1.p.1">The value of this keyword MUST be a non-negative integer. </p>
<p id="rfc.section.6.5.1.p.2">An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword. </p>
<h1 id="rfc.section.6.5.2"><a href="#rfc.section.6.5.2">6.5.2.</a> minProperties</h1>
<p id="rfc.section.6.5.2.p.1">The value of this keyword MUST be a non-negative integer. </p>
<p id="rfc.section.6.5.2.p.2">An object instance is valid against "minProperties" if its number of properties is greater than, or equal to, the value of this keyword. </p>
<p id="rfc.section.6.5.2.p.3">Omitting this keyword has the same behavior as a value of 0. </p>
<h1 id="rfc.section.6.5.3"><a href="#rfc.section.6.5.3">6.5.3.</a> required</h1>
<p id="rfc.section.6.5.3.p.1">The value of this keyword MUST be an array. Elements of this array, if any, MUST be strings, and MUST be unique. </p>
<p id="rfc.section.6.5.3.p.2">An object instance is valid against this keyword if every item in the array is the name of a property in the instance. </p>
<p id="rfc.section.6.5.3.p.3">Omitting this keyword has the same behavior as an empty array. </p>
<h1 id="rfc.section.6.5.4"><a href="#rfc.section.6.5.4">6.5.4.</a> properties</h1>
<p id="rfc.section.6.5.4.p.1">The value of "properties" MUST be an object. Each value of this object MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.5.4.p.2">This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. </p>
<p id="rfc.section.6.5.4.p.3">Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value, the child instance for that name successfully validates against the corresponding schema. </p>
<p id="rfc.section.6.5.4.p.4">Omitting this keyword has the same behavior as an empty object. </p>
<h1 id="rfc.section.6.5.5"><a href="#rfc.section.6.5.5">6.5.5.</a> patternProperties</h1>
<p id="rfc.section.6.5.5.p.1">The value of "patternProperties" MUST be an object. Each property name of this object SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. Each property value of this object MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.5.5.p.2">This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. Validation of the primitive instance type against this keyword always succeeds. </p>
<p id="rfc.section.6.5.5.p.3">Validation succeeds if, for each instance name that matches any regular expressions that appear as a property name in this keyword's value, the child instance for that name successfully validates against each schema that corresponds to a matching regular expression. </p>
<p id="rfc.section.6.5.5.p.4">Omitting this keyword has the same behavior as an empty object. </p>
<h1 id="rfc.section.6.5.6"><a href="#rfc.section.6.5.6">6.5.6.</a> additionalProperties</h1>
<p id="rfc.section.6.5.6.p.1">The value of "additionalProperties" MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.5.6.p.2">This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. </p>
<p id="rfc.section.6.5.6.p.3">Validation with "additionalProperties" applies only to the child values of instance names that do not match any names in "properties", and do not match any regular expression in "patternProperties". </p>
<p id="rfc.section.6.5.6.p.4">For all such properties, validation succeeds if the child instance validates against the "additionalProperties" schema. </p>
<p id="rfc.section.6.5.6.p.5">Omitting this keyword has the same behavior as an empty schema. </p>
<h1 id="rfc.section.6.5.7"><a href="#rfc.section.6.5.7">6.5.7.</a> dependencies</h1>
<p><a id="CREF1" class="info">[CREF1]<span class="info">This keyword may be split into two, with the variation that uses an array of property names rather than a subschema getting a new name. The dual behavior is confusing and relatively difficult to implement. In the previous draft, we proposed dropping the keyword altogether, or dropping one of its forms, but we received feedback in support of keeping it. See issues #442 and #528 at <https://github.com/json-schema-org/json-schema-spec/issues> for further discussion. Further feedback is encouraged. </span></a> </p>
<p id="rfc.section.6.5.7.p.2">This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. </p>
<p id="rfc.section.6.5.7.p.3">This keyword's value MUST be an object. Each property specifies a dependency. Each dependency value MUST be an array or a valid JSON Schema. </p>
<p id="rfc.section.6.5.7.p.4">If the dependency value is a subschema, and the dependency key is a property in the instance, the entire instance must validate against the dependency value. </p>
<p id="rfc.section.6.5.7.p.5">If the dependency value is an array, each element in the array, if any, MUST be a string, and MUST be unique. If the dependency key is a property in the instance, each of the items in the dependency value must be a property that exists in the instance. </p>
<p id="rfc.section.6.5.7.p.6">Omitting this keyword has the same behavior as an empty object. </p>
<h1 id="rfc.section.6.5.8"><a href="#rfc.section.6.5.8">6.5.8.</a> propertyNames</h1>
<p id="rfc.section.6.5.8.p.1">The value of "propertyNames" MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.5.8.p.2">If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema. Note the property name that the schema is testing will always be a string. </p>
<p id="rfc.section.6.5.8.p.3">Omitting this keyword has the same behavior as an empty schema. </p>
<h1 id="rfc.section.6.6"><a href="#rfc.section.6.6">6.6.</a> <a href="#conditional" id="conditional">Keywords for Applying Subschemas Conditionally</a></h1>
<p id="rfc.section.6.6.p.1">These keywords work together to implement conditional application of a subschema based on the outcome of another subschema. </p>
<p id="rfc.section.6.6.p.2">These keywords MUST NOT interact with each other across subschema boundaries. In other words, an "if" in one branch of an "allOf" MUST NOT have an impact on a "then" or "else" in another branch. </p>
<p id="rfc.section.6.6.p.3">There is no default behavior for any of these keywords when they are not present. In particular, they MUST NOT be treated as if present with an empty schema, and when "if" is not present, both "then" and "else" MUST be entirely ignored. </p>
<h1 id="rfc.section.6.6.1"><a href="#rfc.section.6.6.1">6.6.1.</a> if</h1>
<p id="rfc.section.6.6.1.p.1">This keyword's value MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.6.1.p.2">This validation outcome of this keyword's subschema has no direct effect on the overall validation result. Rather, it controls which of the "then" or "else" keywords are evaluated. </p>
<p id="rfc.section.6.6.1.p.3">Instances that successfully validate against this keyword's subschema MUST also be valid against the subschema value of the "then" keyword, if present. </p>
<p id="rfc.section.6.6.1.p.4">Instances that fail to validate against this keyword's subschema MUST also be valid against the subschema value of the "else" keyword, if present. </p>
<p id="rfc.section.6.6.1.p.5">If <a href="#annotations">annotations</a> <cite title="NONE">[annotations]</cite> are being collected, they are collected from this keyword's subschema in the usual way, including when the keyword is present without either "then" or "else". </p>
<h1 id="rfc.section.6.6.2"><a href="#rfc.section.6.6.2">6.6.2.</a> then</h1>
<p id="rfc.section.6.6.2.p.1">This keyword's value MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.6.2.p.2">When "if" is present, and the instance successfully validates against its subschema, then valiation succeeds against this keyword if the instance also successfully validates against this keyword's subschema. </p>
<p id="rfc.section.6.6.2.p.3">This keyword has no effect when "if" is absent, or when the instance fails to validate against its subschema. Implementations MUST NOT evaluate the instance against this keyword, for either validation or annotation collection purposes, in such cases. </p>
<h1 id="rfc.section.6.6.3"><a href="#rfc.section.6.6.3">6.6.3.</a> else</h1>
<p id="rfc.section.6.6.3.p.1">This keyword's value MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.6.3.p.2">When "if" is present, and the instance fails to validate against its subschema, then valiation succeeds against this keyword if the instance successfully validates against this keyword's subschema. </p>
<p id="rfc.section.6.6.3.p.3">This keyword has no effect when "if" is absent, or when the instance successfully validates against its subschema. Implementations MUST NOT evaluate the instance against this keyword, for either validation or annotation collection purposes, in such cases. </p>
<h1 id="rfc.section.6.7"><a href="#rfc.section.6.7">6.7.</a> <a href="#logic" id="logic">Keywords for Applying Subschemas With Boolean Logic</a></h1>
<h1 id="rfc.section.6.7.1"><a href="#rfc.section.6.7.1">6.7.1.</a> allOf</h1>
<p id="rfc.section.6.7.1.p.1">This keyword's value MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.7.1.p.2">An instance validates successfully against this keyword if it validates successfully against all schemas defined by this keyword's value. </p>
<h1 id="rfc.section.6.7.2"><a href="#rfc.section.6.7.2">6.7.2.</a> anyOf</h1>
<p id="rfc.section.6.7.2.p.1">This keyword's value MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.7.2.p.2">An instance validates successfully against this keyword if it validates successfully against at least one schema defined by this keyword's value. </p>
<h1 id="rfc.section.6.7.3"><a href="#rfc.section.6.7.3">6.7.3.</a> oneOf</h1>
<p id="rfc.section.6.7.3.p.1">This keyword's value MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.7.3.p.2">An instance validates successfully against this keyword if it validates successfully against exactly one schema defined by this keyword's value. </p>
<h1 id="rfc.section.6.7.4"><a href="#rfc.section.6.7.4">6.7.4.</a> not</h1>
<p id="rfc.section.6.7.4.p.1">This keyword's value MUST be a valid JSON Schema. </p>
<p id="rfc.section.6.7.4.p.2">An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword. </p>
<h1 id="rfc.section.7"><a href="#rfc.section.7">7.</a> <a href="#format" id="format">Semantic Validation With "format"</a></h1>
<h1 id="rfc.section.7.1"><a href="#rfc.section.7.1">7.1.</a> Foreword</h1>
<p id="rfc.section.7.1.p.1">Structural validation alone may be insufficient to validate that an instance meets all the requirements of an application. The "format" keyword is defined to allow interoperable semantic validation for a fixed subset of values which are accurately described by authoritative resources, be they RFCs or other external specifications. </p>
<p id="rfc.section.7.1.p.2">The value of this keyword is called a format attribute. It MUST be a string. A format attribute can generally only validate a given set of instance types. If the type of the instance to validate is not in this set, validation for this format attribute and instance SHOULD succeed. </p>
<h1 id="rfc.section.7.2"><a href="#rfc.section.7.2">7.2.</a> Implementation Requirements</h1>
<p id="rfc.section.7.2.p.1">The "format" keyword functions as both an annotation (<a href="#annotations">Section 3.3</a>) and as an assertion (<a href="#assertions">Section 3.2</a>). While no special effort is required to implement it as an annotation conveying semantic meaning, implementing validation is non-trivial. </p>
<p id="rfc.section.7.2.p.2">Implementations MAY support the "format" keyword as a validation assertion. Should they choose to do so: </p>
<ul class="empty">
<li>they SHOULD implement validation for attributes defined below;</li>
<li>they SHOULD offer an option to disable validation for this keyword.</li>
</ul>
<p> </p>
<p id="rfc.section.7.2.p.3">Implementations MAY add custom format attributes. Save for agreement between parties, schema authors SHALL NOT expect a peer implementation to support this keyword and/or custom format attributes. </p>
<h1 id="rfc.section.7.3"><a href="#rfc.section.7.3">7.3.</a> Defined Formats</h1>
<h1 id="rfc.section.7.3.1"><a href="#rfc.section.7.3.1">7.3.1.</a> Dates and Times</h1>
<p id="rfc.section.7.3.1.p.1">These attributes apply to string instances. </p>
<p id="rfc.section.7.3.1.p.2">Date and time format names are derived from <a href="#RFC3339">RFC 3339, section 5.6</a> <cite title="NONE">[RFC3339]</cite>. </p>
<p id="rfc.section.7.3.1.p.3">Implementations supporting formats SHOULD implement support for the following attributes: </p>
<dl>
<dt>date-time:</dt>
<dd style="margin-left: 8">A string instance is valid against this attribute if it is a valid representation according to the "date-time" production. </dd>
<dt>date:</dt>
<dd style="margin-left: 8">A string instance is valid against this attribute if it is a valid representation according to the "full-date" production. </dd>
<dt>time:</dt>
<dd style="margin-left: 8">A string instance is valid against this attribute if it is a valid representation according to the "full-time" production. </dd>
</dl>
<p> </p>
<p id="rfc.section.7.3.1.p.4">Implementations MAY support additional attributes using the other production names defined in that section. If "full-date" or "full-time" are implemented, the corresponding short form ("date" or "time" respectively) MUST be implemented, and MUST behave identically. Implementations SHOULD NOT define extension attributes with any name matching an RFC 3339 production unless it validates according to the rules of that production. <a id="CREF2" class="info">[CREF2]<span class="info">There is not currently consensus on the need for supporting all RFC 3339 formats, so this approach of reserving the namespace will encourage experimentation without committing to the entire set. Either the format implementation requirements will become more flexible in general, or these will likely either be promoted to fully specified attributes or dropped. </span></a> </p>
<h1 id="rfc.section.7.3.2"><a href="#rfc.section.7.3.2">7.3.2.</a> Email Addresses</h1>
<p id="rfc.section.7.3.2.p.1">These attributes apply to string instances. </p>
<p id="rfc.section.7.3.2.p.2">A string instance is valid against these attributes if it is a valid Internet email address as follows: </p>
<dl>
<dt>email:</dt>
<dd style="margin-left: 8">As defined by <a href="#RFC5322">RFC 5322, section 3.4.1</a> <cite title="NONE">[RFC5322]</cite>. </dd>
<dt>idn-email:</dt>
<dd style="margin-left: 8">As defined by <a href="#RFC6531">RFC 6531</a> <cite title="NONE">[RFC6531]</cite> </dd>
</dl>
<p> Note that all strings valid against the "email" attribute are also valid against the "idn-email" attribute. </p>
<h1 id="rfc.section.7.3.3"><a href="#rfc.section.7.3.3">7.3.3.</a> Hostnames</h1>
<p id="rfc.section.7.3.3.p.1">These attributes apply to string instances. </p>
<p id="rfc.section.7.3.3.p.2">A string instance is valid against these attributes if it is a valid representation for an Internet hostname as follows: </p>
<dl>
<dt>hostname:</dt>
<dd style="margin-left: 8">As defined by <a href="#RFC1034">RFC 1034, section 3.1</a> <cite title="NONE">[RFC1034]</cite>, including host names produced using the Punycode algorithm specified in <a href="#RFC5891">RFC 5891, section 4.4</a> <cite title="NONE">[RFC5891]</cite>. </dd>
<dt>idn-hostname:</dt>
<dd style="margin-left: 8">As defined by either RFC 1034 as for hostname, or an internationalized hostname as defined by <a href="#RFC5890">RFC 5890, section 2.3.2.3</a> <cite title="NONE">[RFC5890]</cite>. </dd>
</dl>
<p> Note that all strings valid against the "hostname" attribute are also valid against the "idn-hostname" attribute. </p>
<h1 id="rfc.section.7.3.4"><a href="#rfc.section.7.3.4">7.3.4.</a> IP Addresses</h1>
<p id="rfc.section.7.3.4.p.1">These attributes apply to string instances. </p>
<p id="rfc.section.7.3.4.p.2">A string instance is valid against these attributes if it is a valid representation of an IP address as follows: </p>
<dl>
<dt>ipv4:</dt>
<dd style="margin-left: 8">An IPv4 address according to the "dotted-quad" ABNF syntax as defined in <a href="#RFC2673">RFC 2673, section 3.2</a> <cite title="NONE">[RFC2673]</cite>. </dd>
<dt>ipv6:</dt>
<dd style="margin-left: 8">An IPv6 address as defined in <a href="#RFC4291">RFC 4291, section 2.2</a> <cite title="NONE">[RFC4291]</cite>. </dd>
</dl>
<p> </p>
<h1 id="rfc.section.7.3.5"><a href="#rfc.section.7.3.5">7.3.5.</a> Resource Identifiers</h1>
<p id="rfc.section.7.3.5.p.1">These attributes apply to string instances. </p>
<p/>
<dl>
<dt>uri:</dt>
<dd style="margin-left: 8">A string instance is valid against this attribute if it is a valid URI, according to <a href="#RFC3986">[RFC3986]</a>. </dd>
<dt>uri-reference:</dt>
<dd style="margin-left: 8">A string instance is valid against this attribute if it is a valid URI Reference (either a URI or a relative-reference), according to <a href="#RFC3986">[RFC3986]</a>. </dd>
<dt>iri:</dt>
<dd style="margin-left: 8">A string instance is valid against this attribute if it is a valid IRI, according to <a href="#RFC3987">[RFC3987]</a>. </dd>
<dt>iri-reference:</dt>
<dd style="margin-left: 8">A string instance is valid against this attribute if it is a valid IRI Reference (either an IRI or a relative-reference), according to <a href="#RFC3987">[RFC3987]</a>. </dd>
</dl>
<p> Note that all valid URIs are valid IRIs, and all valid URI References are also valid IRI References. </p>
<h1 id="rfc.section.7.3.6"><a href="#rfc.section.7.3.6">7.3.6.</a> uri-template</h1>
<p id="rfc.section.7.3.6.p.1">This attribute applies to string instances. </p>
<p id="rfc.section.7.3.6.p.2">A string instance is valid against this attribute if it is a valid URI Template (of any level), according to <a href="#RFC6570">[RFC6570]</a>. </p>
<p id="rfc.section.7.3.6.p.3">Note that URI Templates may be used for IRIs; there is no separate IRI Template specification. </p>
<h1 id="rfc.section.7.3.7"><a href="#rfc.section.7.3.7">7.3.7.</a> JSON Pointers</h1>
<p id="rfc.section.7.3.7.p.1">These attributes apply to string instances. </p>
<p/>
<dl>
<dt>json-pointer:</dt>
<dd style="margin-left: 8">A string instance is valid against this attribute if it is a valid JSON string representation of a JSON Pointer, according to <a href="#RFC6901">RFC 6901, section 5</a> <cite title="NONE">[RFC6901]</cite>. </dd>
<dt>relative-json-pointer:</dt>
<dd style="margin-left: 8">A string instance is valid against this attribute if it is a valid <a href="#relative-json-pointer">Relative JSON Pointer</a> <cite title="NONE">[relative-json-pointer]</cite>. </dd>
</dl>
<p> To allow for both absolute and relative JSON Pointers, use "anyOf" or "oneOf" to indicate support for either format. </p>
<h1 id="rfc.section.7.3.8"><a href="#rfc.section.7.3.8">7.3.8.</a> regex</h1>
<p id="rfc.section.7.3.8.p.1">This attribute applies to string instances. </p>
<p id="rfc.section.7.3.8.p.2">A regular expression, which SHOULD be valid according to the <a href="#ecma262">ECMA 262</a> <cite title="NONE">[ecma262]</cite> regular expression dialect. </p>
<p id="rfc.section.7.3.8.p.3">Implementations that validate formats MUST accept at least the subset of ECMA 262 defined in the <a href="#regexInterop">Regular Expressions</a> <cite title="NONE">[regexInterop]</cite> section of this specification, and SHOULD accept all valid ECMA 262 expressions. </p>
<h1 id="rfc.section.8"><a href="#rfc.section.8">8.</a> <a href="#content" id="content">String-Encoding Non-JSON Data</a></h1>
<h1 id="rfc.section.8.1"><a href="#rfc.section.8.1">8.1.</a> Foreword</h1>
<p id="rfc.section.8.1.p.1">Properties defined in this section indicate that an instance contains non-JSON data encoded in a JSON string. They describe the type of content and how it is encoded. </p>
<p id="rfc.section.8.1.p.2">These properties provide additional information required to interpret JSON data as rich multimedia documents. </p>
<h1 id="rfc.section.8.2"><a href="#rfc.section.8.2">8.2.</a> Implementation Requirements</h1>
<p id="rfc.section.8.2.p.1">The content keywords function as both annotations (<a href="#annotations">Section 3.3</a>) and as assertions (<a href="#assertions">Section 3.2</a>). While no special effort is required to implement them as annotations conveying how applications can interpret the data in the string, implementing validation of conformance to the media type and encoding is non-trivial. </p>
<p id="rfc.section.8.2.p.2">Implementations MAY support the "contentMediaType" and "contentEncoding" keywords as validation assertions. Should they choose to do so, they SHOULD offer an option to disable validation for these keywords. </p>
<h1 id="rfc.section.8.3"><a href="#rfc.section.8.3">8.3.</a> contentEncoding</h1>
<p id="rfc.section.8.3.p.1">If the instance value is a string, this property defines that the string SHOULD be interpreted as binary data and decoded using the encoding named by this property. <a href="#RFC2045">RFC 2045, Sec 6.1</a> <cite title="NONE">[RFC2045]</cite> lists the possible values for this property. </p>
<p id="rfc.section.8.3.p.2">The value of this property MUST be a string. </p>
<p id="rfc.section.8.3.p.3">The value of this property SHOULD be ignored if the instance described is not a string. </p>
<h1 id="rfc.section.8.4"><a href="#rfc.section.8.4">8.4.</a> contentMediaType</h1>
<p id="rfc.section.8.4.p.1">The value of this property must be a media type, as defined by <a href="#RFC2046">RFC 2046</a> <cite title="NONE">[RFC2046]</cite>. This property defines the media type of instances which this schema defines. </p>
<p id="rfc.section.8.4.p.2">The value of this property MUST be a string. </p>
<p id="rfc.section.8.4.p.3">The value of this property SHOULD be ignored if the instance described is not a string. </p>
<p id="rfc.section.8.4.p.4">If the "contentEncoding" property is not present, but the instance value is a string, then the value of this property SHOULD specify a text document type, and the character set SHOULD be the character set into which the JSON string value was decoded (for which the default is Unicode). </p>
<h1 id="rfc.section.8.5"><a href="#rfc.section.8.5">8.5.</a> Example</h1>
<p>Here is an example schema, illustrating the use of "contentEncoding" and "contentMediaType": </p>
<pre>
{
"type": "string",
"contentEncoding": "base64",
"contentMediaType": "image/png"
}
</pre>
<p>Instances described by this schema should be strings, and their values should be interpretable as base64-encoded PNG images. </p>
<p>Another example: </p>
<pre>
{
"type": "string",
"contentMediaType": "text/html"
}
</pre>
<p>Instances described by this schema should be strings containing HTML, using whatever character set the JSON string was decoded into (default is Unicode). </p>
<h1 id="rfc.section.9"><a href="#rfc.section.9">9.</a> Schema Re-Use With "definitions"</h1>
<p id="rfc.section.9.p.1">The "definitions" keywords provides a standardized location for schema authors to inline re-usable JSON Schemas into a more general schema. The keyword does not directly affect the validation result. </p>
<p id="rfc.section.9.p.2">This keyword's value MUST be an object. Each member value of this object MUST be a valid JSON Schema. </p>
<pre>
{
"type": "array",
"items": { "$ref": "#/definitions/positiveInteger" },
"definitions": {
"positiveInteger": {
"type": "integer",
"exclusiveMinimum": 0
}
}
}
</pre>
<p id="rfc.section.9.p.3">As an example, here is a schema describing an array of positive integers, where the positive integer constraint is a subschema in "definitions": </p>
<h1 id="rfc.section.10"><a href="#rfc.section.10">10.</a> Schema Annotations</h1>
<p id="rfc.section.10.p.1">Schema validation is a useful mechanism for annotating instance data with additional information. The rules for determining when and how annotations are associated with an instance are outlined in section <a href="#annotations">3.3</a>. </p>
<p id="rfc.section.10.p.2">These general-purpose annotation keywords provide commonly used information for documentation and user interface display purposes. They are not intended to form a comprehensive set of features. Rather, additional vocabularies can be defined for more complex annotation-based applications. </p>
<h1 id="rfc.section.10.1"><a href="#rfc.section.10.1">10.1.</a> "title" and "description"</h1>
<p id="rfc.section.10.1.p.1">The value of both of these keywords MUST be a string. </p>