/JsonSchemaValidator/draft-04/JSON Schema: interactive and non interactive validation.html
HTML | 1050 lines | 785 code | 133 blank | 132 comment | 0 complexity | d9fcc948ce83acac1447485162350ff3 MD5 | raw file
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html lang="en"><head><title>JSON Schema: interactive and non interactive validation</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta name="description" content="JSON Schema: interactive and non interactive validation">
- <meta name="keywords" content="JSON, Schema, validation">
- <meta name="generator" content="xml2rfc v1.36 (http://xml.resource.org/)">
- <style type='text/css'><!--
- body {
- font-family: verdana, charcoal, helvetica, arial, sans-serif;
- font-size: small; color: #000; background-color: #FFF;
- margin: 2em;
- }
- h1, h2, h3, h4, h5, h6 {
- font-family: helvetica, monaco, "MS Sans Serif", arial, sans-serif;
- font-weight: bold; font-style: normal;
- }
- h1 { color: #900; background-color: transparent; text-align: right; }
- h3 { color: #333; background-color: transparent; }
- td.RFCbug {
- font-size: x-small; text-decoration: none;
- width: 30px; height: 30px; padding-top: 2px;
- text-align: justify; vertical-align: middle;
- background-color: #000;
- }
- td.RFCbug span.RFC {
- font-family: monaco, charcoal, geneva, "MS Sans Serif", helvetica, verdana, sans-serif;
- font-weight: bold; color: #666;
- }
- td.RFCbug span.hotText {
- font-family: charcoal, monaco, geneva, "MS Sans Serif", helvetica, verdana, sans-serif;
- font-weight: normal; text-align: center; color: #FFF;
- }
- table.TOCbug { width: 30px; height: 15px; }
- td.TOCbug {
- text-align: center; width: 30px; height: 15px;
- color: #FFF; background-color: #900;
- }
- td.TOCbug a {
- font-family: monaco, charcoal, geneva, "MS Sans Serif", helvetica, sans-serif;
- font-weight: bold; font-size: x-small; text-decoration: none;
- color: #FFF; background-color: transparent;
- }
- td.header {
- font-family: arial, helvetica, sans-serif; font-size: x-small;
- vertical-align: top; width: 33%;
- color: #FFF; background-color: #666;
- }
- td.author { font-weight: bold; font-size: x-small; margin-left: 4em; }
- td.author-text { font-size: x-small; }
- /* 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 { font-weight: bold; }
- a:link { color: #900; background-color: transparent; }
- a:visited { color: #633; background-color: transparent; }
- a:active { color: #633; background-color: transparent; }
- p { margin-left: 2em; margin-right: 2em; }
- p.copyright { font-size: x-small; }
- p.toc { font-size: small; font-weight: bold; margin-left: 3em; }
- table.toc { margin: 0 0 0 3em; padding: 0; border: 0; vertical-align: text-top; }
- td.toc { font-size: small; font-weight: bold; vertical-align: text-top; }
- ol.text { margin-left: 2em; margin-right: 2em; }
- ul.text { margin-left: 2em; margin-right: 2em; }
- li { margin-left: 3em; }
- /* RFC-2629 <spanx>s and <artwork>s. */
- em { font-style: italic; }
- strong { font-weight: bold; }
- dfn { font-weight: bold; font-style: normal; }
- cite { font-weight: normal; font-style: normal; }
- tt { color: #036; }
- tt, pre, pre dfn, pre em, pre cite, pre span {
- font-family: "Courier New", Courier, monospace; font-size: small;
- }
- pre {
- text-align: left; padding: 4px;
- color: #000; background-color: #CCC;
- }
- pre dfn { color: #900; }
- pre em { color: #66F; background-color: #FFC; font-weight: normal; }
- pre .key { color: #33C; font-weight: bold; }
- pre .id { color: #900; }
- pre .str { color: #000; background-color: #CFF; }
- pre .val { color: #066; }
- pre .rep { color: #909; }
- pre .oth { color: #000; background-color: #FCF; }
- pre .err { background-color: #FCC; }
- /* RFC-2629 <texttable>s. */
- table.all, table.full, table.headers, table.none {
- font-size: small; text-align: center; border-width: 2px;
- vertical-align: top; border-collapse: collapse;
- }
- table.all, table.full { border-style: solid; border-color: black; }
- table.headers, table.none { border-style: none; }
- th {
- font-weight: bold; border-color: black;
- border-width: 2px 2px 3px 2px;
- }
- table.all th, table.full th { border-style: solid; }
- table.headers th { border-style: none none solid none; }
- table.none th { border-style: none; }
- table.all td {
- border-style: solid; border-color: #333;
- border-width: 1px 2px;
- }
- table.full td, table.headers td, table.none td { border-style: none; }
- hr { height: 1px; }
- hr.insert {
- width: 80%; border-style: none; border-width: 0;
- color: #CCC; background-color: #CCC;
- }
- --></style>
- </head>
- <body>
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <table summary="layout" width="66%" border="0" cellpadding="0" cellspacing="0"><tr><td><table summary="layout" width="100%" border="0" cellpadding="2" cellspacing="1">
- <tr><td class="header">Internet Engineering Task Force</td><td class="header">fge. Galiegue</td></tr>
- <tr><td class="header">Internet-Draft</td><td class="header"> </td></tr>
- <tr><td class="header">Intended status: Informational</td><td class="header">K. Zyp, Ed.</td></tr>
- <tr><td class="header">Expires: August 3, 2013</td><td class="header">SitePen (USA)</td></tr>
- <tr><td class="header"> </td><td class="header">G. Court</td></tr>
- <tr><td class="header"> </td><td class="header">January 30, 2013</td></tr>
- </table></td></tr></table>
- <h1><br />JSON Schema: interactive and non interactive validation<br />json-schema-validation</h1>
- <h3>Abstract</h3>
- <p>
- JSON Schema (application/schema+json) has several purposes, one of which is instance
- validation. The validation process may be interactive or non interactive. For
- instance, applications may use JSON Schema to build a user interface enabling
- interactive content generation in addition to user input checking, or validate data
- retrieved from various sources. This specification describes schema keywords
- dedicated to validation purposes.
-
- </p>
- <h3>Status of This Memo</h3>
- <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 August 3, 2013.</p>
- <h3>Copyright Notice</h3>
- <p>
- Copyright (c) 2013 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>
- <a name="toc"></a><br /><hr />
- <h3>Table of Contents</h3>
- <p class="toc">
- <a href="#anchor1">1.</a>
- Introduction<br />
- <a href="#anchor2">2.</a>
- Conventions and Terminology<br />
- <a href="#anchor3">3.</a>
- Interoperability considerations<br />
- <a href="#anchor4">3.1.</a>
- Validation of string instances<br />
- <a href="#anchor5">3.2.</a>
- Validation of numeric instances<br />
- <a href="#anchor6">3.3.</a>
- Regular expressions<br />
- <a href="#anchor7">4.</a>
- General validation considerations<br />
- <a href="#anchor8">4.1.</a>
- Keywords and instance primitive types<br />
- <a href="#anchor9">4.2.</a>
- Inter-dependent keywords<br />
- <a href="#anchor10">4.3.</a>
- Default values for missing keywords<br />
- <a href="#anchor11">4.4.</a>
- Validation of container instances<br />
- <a href="#anchor12">5.</a>
- Validation keywords sorted by instance types<br />
- <a href="#anchor13">5.1.</a>
- Validation keywords for numeric instances (number and integer)<br />
- <a href="#anchor14">5.1.1.</a>
- multipleOf<br />
- <a href="#anchor17">5.1.2.</a>
- maximum and exclusiveMaximum<br />
- <a href="#anchor21">5.1.3.</a>
- minimum and exclusiveMinimum<br />
- <a href="#anchor25">5.2.</a>
- Validation keywords for strings<br />
- <a href="#anchor26">5.2.1.</a>
- maxLength<br />
- <a href="#anchor29">5.2.2.</a>
- minLength<br />
- <a href="#anchor33">5.2.3.</a>
- pattern<br />
- <a href="#anchor36">5.3.</a>
- Validation keywords for arrays<br />
- <a href="#anchor37">5.3.1.</a>
- additionalItems and items<br />
- <a href="#anchor42">5.3.2.</a>
- maxItems<br />
- <a href="#anchor45">5.3.3.</a>
- minItems<br />
- <a href="#anchor49">5.3.4.</a>
- uniqueItems<br />
- <a href="#anchor53">5.4.</a>
- Validation keywords for objects<br />
- <a href="#anchor54">5.4.1.</a>
- maxProperties<br />
- <a href="#anchor57">5.4.2.</a>
- minProperties<br />
- <a href="#anchor61">5.4.3.</a>
- required<br />
- <a href="#anchor64">5.4.4.</a>
- additionalProperties, properties and patternProperties<br />
- <a href="#anchor70">5.4.5.</a>
- dependencies<br />
- <a href="#anchor75">5.5.</a>
- Validation keywords for any instance type<br />
- <a href="#anchor76">5.5.1.</a>
- enum<br />
- <a href="#anchor79">5.5.2.</a>
- type<br />
- <a href="#anchor82">5.5.3.</a>
- allOf<br />
- <a href="#anchor85">5.5.4.</a>
- anyOf<br />
- <a href="#anchor88">5.5.5.</a>
- oneOf<br />
- <a href="#anchor91">5.5.6.</a>
- not<br />
- <a href="#anchor94">5.5.7.</a>
- definitions<br />
- <a href="#anchor97">6.</a>
- Metadata keywords<br />
- <a href="#anchor98">6.1.</a>
- "title" and "description"<br />
- <a href="#anchor99">6.1.1.</a>
- Valid values<br />
- <a href="#anchor100">6.1.2.</a>
- Purpose<br />
- <a href="#anchor101">6.2.</a>
- "default"<br />
- <a href="#anchor102">6.2.1.</a>
- Valid values<br />
- <a href="#anchor103">6.2.2.</a>
- Purpose<br />
- <a href="#anchor104">7.</a>
- Semantic validation with "format"<br />
- <a href="#anchor105">7.1.</a>
- Foreword<br />
- <a href="#anchor106">7.2.</a>
- Implementation requirements<br />
- <a href="#anchor107">7.3.</a>
- Defined attributes<br />
- <a href="#anchor108">7.3.1.</a>
- date-time<br />
- <a href="#anchor111">7.3.2.</a>
- email<br />
- <a href="#anchor114">7.3.3.</a>
- hostname<br />
- <a href="#anchor117">7.3.4.</a>
- ipv4<br />
- <a href="#anchor120">7.3.5.</a>
- ipv6<br />
- <a href="#anchor123">7.3.6.</a>
- uri<br />
- <a href="#anchor126">8.</a>
- Reference algorithms for calculating children schemas<br />
- <a href="#anchor127">8.1.</a>
- Foreword<br />
- <a href="#anchor128">8.2.</a>
- Array elements<br />
- <a href="#anchor129">8.2.1.</a>
- Defining characteristic<br />
- <a href="#anchor130">8.2.2.</a>
- Implied keywords and default values.<br />
- <a href="#anchor131">8.2.3.</a>
- Calculation<br />
- <a href="#anchor134">8.3.</a>
- Object members<br />
- <a href="#anchor135">8.3.1.</a>
- Defining characteristic<br />
- <a href="#anchor136">8.3.2.</a>
- Implied keywords<br />
- <a href="#anchor137">8.3.3.</a>
- Calculation<br />
- <a href="#anchor142">9.</a>
- IANA Considerations<br />
- <a href="#rfc.references1">10.</a>
- References<br />
- <a href="#rfc.references1">10.1.</a>
- Normative References<br />
- <a href="#rfc.references2">10.2.</a>
- Informative References<br />
- <a href="#anchor145">Appendix A.</a>
- ChangeLog<br />
- </p>
- <br clear="all" />
- <a name="anchor1"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.1"></a><h3>1.
- Introduction</h3>
- <p>
- JSON Schema can be used to require that a given JSON document (an instance)
- satisfies a certain number of criteria. These criteria are materialized by a set of
- keywords which are described in this specification. In addition, a set of keywords
- is defined to assist in interactive instance generation. Those are also described in
- this specification.
-
- </p>
- <p>
- This specification will use the terminology defined by the JSON Schema core
- specification. It is advised that readers have a copy of this specification.
-
- </p>
- <a name="anchor2"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.2"></a><h3>2.
- Conventions and Terminology</h3>
- <p>
-
- 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 class='info' href='#RFC2119'>RFC 2119<span> (</span><span class='info'>Bradner, S., “Key words for use in RFCs to Indicate Requirement Levels,” March 1997.</span><span>)</span></a> [RFC2119].
-
- </p>
- <p>
- 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>
- This specification uses the term "property set" to refer to the set of an object's
- member names; for instance, the property set of JSON Object { "a": 1, "b": 2 } is [
- "a", "b" ].
-
- </p>
- <p>
- Elements in an array value are said to be unique if no two elements of this array
- are equal, as defined by the core specification.
-
- </p>
- <a name="anchor3"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.3"></a><h3>3.
- Interoperability considerations</h3>
- <a name="anchor4"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.3.1"></a><h3>3.1.
- Validation of string instances</h3>
- <p>
- It should be noted that the nul character (\x00) 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>
- <a name="anchor5"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.3.2"></a><h3>3.2.
- Validation of numeric instances</h3>
- <p>
- The JSON specification does not define any bounds to the scale or precision of
- numeric values. JSON Schema does not define any such bounds either. This means
- that numeric instances processed by JSON Schema can be arbitrarily large and/or
- have an arbitrarily large decimal part, regardless of the ability of the
- underlying programming language to deal with such data.
-
- </p>
- <a name="anchor6"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.3.3"></a><h3>3.3.
- Regular expressions</h3>
- <p>
- Two validation keywords, "pattern" and "patternProperties", use regular
- expressions to express constraints. These regular expressions SHOULD
- be valid according to the <a class='info' href='#ecma262'>ECMA 262<span> (</span><span class='info'>, “ECMA 262 specification,” .</span><span>)</span></a> [ecma262] regular
- expression dialect.
-
- </p>
- <p>
- Furthermore, given the high disparity in regular expression constructs support,
- schema authors SHOULD limit themselves to the following regular expression
- tokens:
- </p>
- <blockquote class="text">
- <p>individual Unicode characters, as defined by the <a class='info' href='#RFC4627'>JSON specification<span> (</span><span class='info'>Crockford, D., “The application/json Media Type for JavaScript Object Notation (JSON),” July 2006.</span><span>)</span></a> [RFC4627];
- </p>
- <p>simple character classes ([abc]), range character classes ([a-z]);
- </p>
- <p>complemented character classes ([^abc], [^a-z]);
- </p>
- <p>simple quantifiers: "+" (one or more), "*" (zero or more), "?" (zero or
- one), and their lazy versions ("+?", "*?", "??");
- </p>
- <p>range quantifiers: "{x}" (exactly x occurrences), "{x,y}" (at least x, at
- most y, occurrences), {x,} (x occurrences or more), and their lazy
- versions;
- </p>
- <p>the beginning-of-input ("^") and end-of-input ("$") anchors;
- </p>
- <p>simple grouping ("(...)") and alternation ("|").
- </p>
- </blockquote><p>
-
- </p>
- <p>
- Finally, implementations MUST NOT consider that regular expressions are
- anchored, neither at the beginning nor at the end. This means, for instance,
- that "es" matches "expression".
-
- </p>
- <a name="anchor7"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.4"></a><h3>4.
- General validation considerations</h3>
- <a name="anchor8"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.4.1"></a><h3>4.1.
- Keywords and instance primitive types</h3>
- <p>
- Some validation keywords only apply to one or more primitive types. When the
- primitive type of the instance cannot be validated by a given keyword,
- validation for this keyword and instance SHOULD succeed.
-
- </p>
- <p>
- This specification groups keywords in different sections, according to the
- primitive type, or types, these keywords validate. Note that some keywords
- validate all instance types.
-
- </p>
- <a name="anchor9"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.4.2"></a><h3>4.2.
- Inter-dependent keywords</h3>
- <p>
- In order to validate an instance, some keywords are influenced by the presence
- (or absence) of other keywords. In this case, all these keywords will be grouped
- in the same section.
-
- </p>
- <a name="anchor10"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.4.3"></a><h3>4.3.
- Default values for missing keywords</h3>
- <p>
- Some keywords, if absent, MAY be regarded by implementations as having
- a default value. In this case, the default value will be mentioned.
-
- </p>
- <a name="anchor11"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.4.4"></a><h3>4.4.
- Validation of container instances</h3>
- <p>
- Keywords with the possibility to validate container instances (arrays or
- objects) only validate the instances themselves and not their children (array
- items or object properties). Some of these keywords do, however, contain
- information which is necessary for calculating which schema(s) a child must be
- valid against. The algorithms to calculate a child instance's relevant schema(s)
- are explained in a separate section.
-
- </p>
- <p>
- It should be noted that while an array element will only have to validate
- against one schema, object member values may have to validate against more than
- one schema.
-
- </p>
- <a name="anchor12"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5"></a><h3>5.
- Validation keywords sorted by instance types</h3>
- <a name="anchor13"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1"></a><h3>5.1.
- Validation keywords for numeric instances (number and integer)</h3>
- <a name="anchor14"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.1"></a><h3>5.1.1.
- multipleOf</h3>
- <a name="anchor15"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.1.1"></a><h3>5.1.1.1.
- Valid values</h3>
- <p>
- The value of "multipleOf" MUST be a JSON number. This number MUST be
- strictly greater than 0.
-
- </p>
- <a name="anchor16"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.1.2"></a><h3>5.1.1.2.
- Conditions for successful validation</h3>
- <p>
- A numeric instance is valid against "multipleOf" if the
- result of the division of the instance by this keyword's value is
- an integer.
-
- </p>
- <a name="anchor17"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.2"></a><h3>5.1.2.
- maximum and exclusiveMaximum</h3>
- <a name="anchor18"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.2.1"></a><h3>5.1.2.1.
- Valid values</h3>
- <p>
- The value of "maximum" MUST be a JSON number. The value of
- "exclusiveMaximum" MUST be a boolean.
-
- </p>
- <p>
- If "exclusiveMaximum" is present, "maximum" MUST also be present.
-
- </p>
- <a name="anchor19"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.2.2"></a><h3>5.1.2.2.
- Conditions for successful validation</h3>
- <p>
- Successful validation depends on the presence and value of
- "exclusiveMaximum":
- </p>
- <blockquote class="text">
- <p>if "exclusiveMaximum" is not present, or has boolean value false,
- then the instance is valid if it is lower than, or equal to, the
- value of "maximum";
- </p>
- <p>if "exclusiveMaximum" has boolean value true, the instance is
- valid if it is strictly lower than the value of "maximum".
- </p>
- </blockquote><p>
-
- </p>
- <a name="anchor20"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.2.3"></a><h3>5.1.2.3.
- Default value</h3>
- <p>
- "exclusiveMaximum", if absent, may be considered as being present with
- boolean value false.
-
- </p>
- <a name="anchor21"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.3"></a><h3>5.1.3.
- minimum and exclusiveMinimum</h3>
- <a name="anchor22"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.3.1"></a><h3>5.1.3.1.
- Valid values</h3>
- <p>
- The value of "minimum" MUST be a JSON number. The value of
- "exclusiveMinimum" MUST be a boolean.
-
- </p>
- <p>
- If "exclusiveMinimum" is present, "minimum" MUST also be present.
-
- </p>
- <a name="anchor23"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.3.2"></a><h3>5.1.3.2.
- Conditions for successful validation</h3>
- <p>
- Successful validation depends on the presence and value of
- "exclusiveMinimum":
- </p>
- <blockquote class="text">
- <p>if "exclusiveMinimum" is not present, or has boolean value false,
- then the instance is valid if it is greater than, or equal to, the
- value of "minimum";
- </p>
- <p>if "exclusiveMinimum" is present and has boolean value true, the
- instance is valid if it is strictly greater than the value of
- "minimum".
- </p>
- </blockquote><p>
-
- </p>
- <a name="anchor24"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.1.3.3"></a><h3>5.1.3.3.
- Default value</h3>
- <p>
- "exclusiveMinimum", if absent, may be considered as being present with
- boolean value false.
-
- </p>
- <a name="anchor25"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2"></a><h3>5.2.
- Validation keywords for strings</h3>
- <a name="anchor26"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2.1"></a><h3>5.2.1.
- maxLength</h3>
- <a name="anchor27"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2.1.1"></a><h3>5.2.1.1.
- Valid values</h3>
- <p>
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- </p>
- <a name="anchor28"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2.1.2"></a><h3>5.2.1.2.
- Conditions for successful validation</h3>
- <p>
- A string instance is valid against this keyword if its
- length is less than, or equal to, the value of this keyword.
-
- </p>
- <p>
- The length of a string instance is defined as the number of its
- characters as defined by <a class='info' href='#RFC4627'>RFC 4627<span> (</span><span class='info'>Crockford, D., “The application/json Media Type for JavaScript Object Notation (JSON),” July 2006.</span><span>)</span></a> [RFC4627].
-
- </p>
- <a name="anchor29"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2.2"></a><h3>5.2.2.
- minLength</h3>
- <a name="anchor30"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2.2.1"></a><h3>5.2.2.1.
- Valid values</h3>
- <p>
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- </p>
- <a name="anchor31"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2.2.2"></a><h3>5.2.2.2.
- Conditions for successful validation</h3>
- <p>
- A string instance is valid against this keyword if its
- length is greater than, or equal to, the value of this keyword.
-
- </p>
- <p>
- The length of a string instance is defined as the number of its
- characters as defined by <a class='info' href='#RFC4627'>RFC 4627<span> (</span><span class='info'>Crockford, D., “The application/json Media Type for JavaScript Object Notation (JSON),” July 2006.</span><span>)</span></a> [RFC4627].
-
- </p>
- <a name="anchor32"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2.2.3"></a><h3>5.2.2.3.
- Default value</h3>
- <p>
- "minLength", if absent, may be considered as being present with integer
- value 0.
-
- </p>
- <a name="anchor33"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2.3"></a><h3>5.2.3.
- pattern</h3>
- <a name="anchor34"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2.3.1"></a><h3>5.2.3.1.
- Valid values</h3>
- <p>
- 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>
- <a name="anchor35"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.2.3.2"></a><h3>5.2.3.2.
- Conditions for successful validation</h3>
- <p>
- A string instance is considered valid if the regular
- expression matches the instance successfully. Recall: regular
- expressions are not implicitly anchored.
-
- </p>
- <a name="anchor36"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3"></a><h3>5.3.
- Validation keywords for arrays</h3>
- <a name="anchor37"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.1"></a><h3>5.3.1.
- additionalItems and items</h3>
- <a name="anchor38"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.1.1"></a><h3>5.3.1.1.
- Valid values</h3>
- <p>
- The value of "additionalItems" MUST be either a boolean or an object. If
- it is an object, this object MUST be a valid JSON Schema.
-
- </p>
- <p>
- The value of "items" MUST be either an object or an array. If it is an
- object, this object MUST be a valid JSON Schema. If it is an array,
- items of this array MUST be objects, and each of these objects MUST be a
- valid JSON Schema.
-
- </p>
- <a name="anchor39"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.1.2"></a><h3>5.3.1.2.
- Conditions for successful validation</h3>
- <p>
- Successful validation of an array instance with regards to these two
- keywords is determined as follows:
- </p>
- <blockquote class="text">
- <p>if "items" is not present, or its value is an object, validation
- of the instance always succeeds, regardless of the value of
- "additionalItems";
- </p>
- <p>if the value of "additionalItems" is boolean value true or an
- object, validation of the instance always succeeds;
- </p>
- <p>if the value of "additionalItems" is boolean value false and the
- value of "items" is an array, the instance is valid if
- its size is less than, or equal to, the size of "items".
- </p>
- </blockquote><p>
-
- </p>
- <a name="anchor40"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.1.3"></a><h3>5.3.1.3.
- Example</h3>
- <p>
- The following example covers the case where "additionalItems" has
- boolean value false and "items" is an array, since this is the only
- situation under which an instance may fail to validate successfully.
-
- </p>
- <p>This is an example schema:
- </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre>
- {
- "items": [ {}, {}, {} ],
- "additionalItems": false
- }
- </pre></div>
- <p>
- With this schema, the following instances are valid:
- </p>
- <blockquote class="text">
- <p>[] (an empty array),
- </p>
- <p>[ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ],
- </p>
- <p>[ 1, 2, 3 ];
- </p>
- </blockquote><p>
-
- </p>
- <p>
- the following instances are invalid:
- </p>
- <blockquote class="text">
- <p>[ 1, 2, 3, 4 ],
- </p>
- <p>[ null, { "a": "b" }, true, 31.000002020013 ]
- </p>
- </blockquote><p>
-
- </p>
- <a name="anchor41"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.1.4"></a><h3>5.3.1.4.
- Default values</h3>
- <p>
- If either keyword is absent, it may be considered present with an empty
- schema.
-
- </p>
- <a name="anchor42"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.2"></a><h3>5.3.2.
- maxItems</h3>
- <a name="anchor43"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.2.1"></a><h3>5.3.2.1.
- Valid values</h3>
- <p>
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- </p>
- <a name="anchor44"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.2.2"></a><h3>5.3.2.2.
- Conditions for successful validation</h3>
- <p>
- An array instance is valid against "maxItems" if its size is
- less than, or equal to, the value of this keyword.
-
- </p>
- <a name="anchor45"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.3"></a><h3>5.3.3.
- minItems</h3>
- <a name="anchor46"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.3.1"></a><h3>5.3.3.1.
- Valid values</h3>
- <p>
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- </p>
- <a name="anchor47"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.3.2"></a><h3>5.3.3.2.
- Conditions for successful validation</h3>
- <p>
- An array instance is valid against "minItems" if its size is
- greater than, or equal to, the value of this keyword.
-
- </p>
- <a name="anchor48"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.3.3"></a><h3>5.3.3.3.
- Default value</h3>
- <p>
- If this keyword is not present, it may be considered present with a
- value of 0.
-
- </p>
- <a name="anchor49"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.4"></a><h3>5.3.4.
- uniqueItems</h3>
- <a name="anchor50"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.4.1"></a><h3>5.3.4.1.
- Valid values</h3>
- <p>
- The value of this keyword MUST be a boolean.
-
- </p>
- <a name="anchor51"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.4.2"></a><h3>5.3.4.2.
- Conditions for successful validation</h3>
- <p>
- 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>
- <a name="anchor52"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.3.4.3"></a><h3>5.3.4.3.
- Default value</h3>
- <p>
- If not present, this keyword may be considered present with boolean
- value false.
-
- </p>
- <a name="anchor53"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.4"></a><h3>5.4.
- Validation keywords for objects</h3>
- <a name="anchor54"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.4.1"></a><h3>5.4.1.
- maxProperties</h3>
- <a name="anchor55"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.4.1.1"></a><h3>5.4.1.1.
- Valid values</h3>
- <p>
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- </p>
- <a name="anchor56"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.4.1.2"></a><h3>5.4.1.2.
- Conditions for successful validation</h3>
- <p>
- An object instance is valid against "maxProperties" if its
- number of properties is less than, or equal to, the value of this
- keyword.
-
- </p>
- <a name="anchor57"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.4.2"></a><h3>5.4.2.
- minProperties</h3>
- <a name="anchor58"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.4.2.1"></a><h3>5.4.2.1.
- Valid values</h3>
- <p>
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- </p>
- <a name="anchor59"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.4.2.2"></a><h3>5.4.2.2.
- Conditions for successful validation</h3>
- <p>
- An object instance is valid against "minProperties" if its
- number of properties is greater than, or equal to, the value of this
- keyword.
-
- </p>
- <a name="anchor60"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.4.2.3"></a><h3>5.4.2.3.
- Default value</h3>
- <p>
- If this keyword is not present, it may be considered present with a
- value of 0.
-
- </p>
- <a name="anchor61"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.4.3"></a><h3>5.4.3.
- required</h3>
- <a name="anchor62"></a><br /><hr />
- <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
- <a name="rfc.section.5.4.3.1"></a><h3>5.4.3.1.
- Valid values</h3>
- <p>
- The value of this keyword MUST be an array. This array MUST have at
- least one element. Elements