Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow boolean schemas everywhere (root and subschemas) #167

Merged
merged 3 commits into from
Dec 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions jsonschema-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,18 @@
</t>
</section>

<section title="JSON Schema document">
<section title="JSON Schema documents">
<t>
A JSON Schema document, or simply a schema, is a JSON document used to describe an instance.
A schema is itself interpreted as an instance.
A JSON schema MUST be an object.
A JSON Schema MUST be an object or a boolean.
</t>
<t>
Boolean values are equivalent to the following behaviors:
<list style="hanging">
<t hangText="true">Always passes validation, as if the empty schema {}</t>
<t hangText="false">Always fails validation, as if the schema { "not":{} }</t>
</list>
</t>
<t>
Properties that are used to describe the instance are called keywords, or schema keywords.
Expand Down Expand Up @@ -231,6 +238,9 @@
In this example document, the schema titled "array item" is a subschema,
and the schema titled "root" is the root schema.
</t>
<t>
As with the root schema, a subschema is either an object or a boolean.
</t>
</section>

</section>
Expand Down Expand Up @@ -299,8 +309,11 @@

<section title="Schema references with $ref">
<t>
Any time a subschema is expected, a schema may instead use an object containing a "$ref" property.
The value of the $ref is a URI Reference.
The "$ref" keyword is used to reference a schema, and provides the ability to validate recursive structures through self-reference.
</t>
<t>
An object schema with a "$ref" property MUST be interpreted as a "$ref" reference.
The value of the "$ref" property MUST be a URI Reference.
Resolved against the current URI base, it identifies the URI of a schema to use.
All other properties in a "$ref" object MUST be ignored.
</t>
Expand All @@ -323,7 +336,7 @@
<xref target="RFC3986">RFC3986 Section 5.1</xref> defines how to determine the default base URI of a document.
</t>
<t>
Informatively, the initial base URI of a schema is the URI it was found at, or a suitable substitute URI if none is known.
Informatively, the initial base URI of a schema is the URI at which it was found, or a suitable substitute URI if none is known.
</t>
</section>

Expand Down Expand Up @@ -660,6 +673,7 @@ User-Agent: so-cool-json-schema/1.0.2 curl/7.43.0
<t hangText="draft-wright-json-schema-01">
<list style="symbols">
<t>Updated intro</t>
<t>Allowed for any schema to be a boolean</t>
</list>
</t>
<t hangText="draft-wright-json-schema-00">
Expand Down
20 changes: 8 additions & 12 deletions jsonschema-validation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,7 @@

<section title="items">
<t>
The value of "items" MUST be either an object or an array of objects.
Each object MUST be a valid JSON Schema.
The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas.
</t>
<t>
If absent, it can be considered present with an empty schema.
Expand All @@ -350,8 +349,7 @@

<section title="additionalItems">
<t>
The value of "additionalItems" MUST be a boolean or an object.
If it is an object, the object MUST be a valid JSON Schema.
The value of "additionalItems" MUST be a valid JSON Schema.
</t>
<t>
If absent, it can be considered present with an empty schema.
Expand Down Expand Up @@ -466,7 +464,7 @@
<section title="properties">
<t>
The value of "properties" MUST be an object. Each value of this object
MUST be an object, and each object MUST be a valid JSON Schema.
MUST be a valid JSON Schema.
</t>
<t>
If absent, it can be considered the same as an empty object.
Expand All @@ -487,7 +485,7 @@
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 an object, and each object MUST be a valid JSON Schema.
MUST be a valid JSON Schema.
</t>
<t>
If absent, it can be considered the same as an empty object.
Expand All @@ -506,8 +504,7 @@

<section title="additionalProperties">
<t>
The value of "additionalProperties" MUST be a boolean or an
object. If it is an object, the object MUST be a valid JSON Schema.
The value of "additionalProperties" MUST be a valid JSON Schema.
</t>
<t>
If "additionalProperties" is absent, it may be considered present with
Expand Down Expand Up @@ -535,12 +532,11 @@
</t>
<t>
This keyword's value MUST be an object. Each property specifies a dependency.
Each dependency value MUST be an object or an array.
Each dependency value MUST be an array or a valid JSON Schema.
</t>
<t>
If the dependency value is an object, it MUST be a valid JSON Schema. If the
dependency key is a property in the instance, the dependency value must validate
against the entire instance.
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.
</t>
<t>
If the dependency value is an array, each element in the array,
Expand Down