diff --git a/hyper-schema.json b/hyper-schema.json
index 3279ad9f..7f591e7f 100644
--- a/hyper-schema.json
+++ b/hyper-schema.json
@@ -6,45 +6,35 @@
{"$ref": "http://json-schema.org/draft-04/schema#"}
],
"properties": {
- "additionalItems": {
- "anyOf": [
- {"type": "boolean"},
- {"$ref": "#"}
- ]
- },
- "additionalProperties": {
- "anyOf": [
- {"type": "boolean"},
- {"$ref": "#"}
- ]
- },
+ "additionalItems": { "$ref": "#/definitions/subSchema" },
+ "additionalProperties": { "$ref": "#/definitions/subSchema" },
"dependencies": {
"additionalProperties": {
"anyOf": [
- {"$ref": "#"},
+ {"$ref": "#/definitions/subSchema"},
{"type": "array"}
]
}
},
"items": {
"anyOf": [
- {"$ref": "#"},
+ {"$ref": "#/definitions/subSchema"},
{"$ref": "#/definitions/schemaArray"}
]
},
"definitions": {
- "additionalProperties": {"$ref": "#"}
+ "additionalProperties": {"$ref": "#/definitions/subSchema"}
},
"patternProperties": {
- "additionalProperties": {"$ref": "#"}
+ "additionalProperties": {"$ref": "#/definitions/subSchema"}
},
"properties": {
- "additionalProperties": {"$ref": "#"}
+ "additionalProperties": {"$ref": "#/definitions/subSchema"}
},
"allOf": {"$ref": "#/definitions/schemaArray"},
"anyOf": {"$ref": "#/definitions/schemaArray"},
"oneOf": {"$ref": "#/definitions/schemaArray"},
- "not": { "$ref": "#" },
+ "not": { "$ref": "#/definitions/subSchema" },
"links": {
"type": "array",
@@ -73,9 +63,13 @@
}
},
"definitions": {
+ "subSchema": {
+ "anyOf": [ {"$ref": "#"}, {"type": "boolean"} ],
+ "default": true
+ },
"schemaArray": {
"type": "array",
- "items": {"$ref": "#"}
+ "items": {"$ref": "#/definitions/subSchema"}
},
"linkDescription": {
"title": "Link Description Object",
@@ -96,7 +90,7 @@
},
"targetSchema": {
"description": "JSON Schema describing the link target",
- "$ref": "#"
+ "$ref": "#/definitions/subschema"
},
"mediaType": {
"description": "media type (as defined by RFC 2046) describing the link target",
@@ -113,7 +107,7 @@
},
"schema": {
"description": "Schema describing the data to submit along with the request",
- "$ref": "#"
+ "$ref": "/definitions/subschema#"
}
}
}
diff --git a/jsonschema-core.xml b/jsonschema-core.xml
index eef1e297..19d0a772 100644
--- a/jsonschema-core.xml
+++ b/jsonschema-core.xml
@@ -187,7 +187,7 @@
A JSON Schema document, or simply a schema, is a JSON document used to describe an instance.
A schema is itself interperted as an instance.
- A JSON schema MUST be an object.
+ A JSON Schema document MUST consist of an object, known as the root schema.
Properties that are used to describe the instance are called keywords, or schema keywords.
@@ -229,6 +229,31 @@
In this example document, the schema titled "array item" is a subschema,
and the schema titled "root" is the root schema.
+
+ A subschema MUST be an object or a boolean, where boolean values are equivalent to object schemas as follows:
+
+
+ true:
+
+
+
+ false:
+
+
@@ -321,7 +346,7 @@
RFC3986 Section 5.1 defines how to determine the default base URI of a document.
- 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.
diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml
index d265e21c..d8b4f942 100644
--- a/jsonschema-validation.xml
+++ b/jsonschema-validation.xml
@@ -313,8 +313,7 @@
- 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 subschema or an array of valid subschemas.
If absent, it can be considered present with an empty schema.
@@ -336,8 +335,7 @@
- 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 subschema.
If absent, it can be considered present with an empty schema.
@@ -437,7 +435,7 @@
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 subschema.
If absent, it can be considered the same as an empty object.
@@ -458,7 +456,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 subschema.
If absent, it can be considered the same as an empty object.
@@ -477,8 +475,7 @@
- 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 subschema.
If "additionalProperties" is absent, it may be considered present with
@@ -506,12 +503,11 @@
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 subschema.
- 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.
If the dependency value is an array, it MUST have at least one element, each
@@ -610,7 +606,7 @@
This keyword's value MUST be an object. Each member value of this object
- MUST be a valid JSON Schema.
+ MUST be a valid subschema.
This keyword plays no role in validation per se. Its role is to provide
diff --git a/schema.json b/schema.json
index 8ebd9a95..15ab91e2 100644
--- a/schema.json
+++ b/schema.json
@@ -3,10 +3,14 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Core schema meta-schema",
"definitions": {
+ "subSchema": {
+ "anyOf": [ {"$ref": "#"}, {"type": "boolean"} ],
+ "default": true
+ },
"schemaArray": {
"type": "array",
"minItems": 1,
- "items": { "$ref": "#" }
+ "items": { "$ref": "#/definitions/subSchema" }
},
"positiveInteger": {
"type": "integer",
@@ -67,19 +71,12 @@
"type": "string",
"format": "regex"
},
- "additionalItems": {
- "anyOf": [
- { "type": "boolean" },
- { "$ref": "#" }
- ],
- "default": {}
- },
+ "additionalItems": { "$ref": "#/definitions/subSchema" },
"items": {
"anyOf": [
- { "$ref": "#" },
+ { "$ref": "#/definitions/subSchema" },
{ "$ref": "#/definitions/schemaArray" }
- ],
- "default": {}
+ ]
},
"maxItems": { "$ref": "#/definitions/positiveInteger" },
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
@@ -90,33 +87,27 @@
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" },
- "additionalProperties": {
- "anyOf": [
- { "type": "boolean" },
- { "$ref": "#" }
- ],
- "default": {}
- },
+ "additionalProperties": { "$ref": "#/definitions/subSchema" },
"definitions": {
"type": "object",
- "additionalProperties": { "$ref": "#" },
+ "additionalProperties": { "$ref": "#/definitions/subSchema" },
"default": {}
},
"properties": {
"type": "object",
- "additionalProperties": { "$ref": "#" },
+ "additionalProperties": { "$ref": "#/definitions/subSchema" },
"default": {}
},
"patternProperties": {
"type": "object",
- "additionalProperties": { "$ref": "#" },
+ "additionalProperties": { "$ref": "#/definitions/subSchema" },
"default": {}
},
"dependencies": {
"type": "object",
"additionalProperties": {
"anyOf": [
- { "$ref": "#" },
+ { "$ref": "#/definitions/subSchema" },
{ "$ref": "#/definitions/stringArray" }
]
}
@@ -141,7 +132,7 @@
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
- "not": { "$ref": "#" }
+ "not": { "$ref": "#/definitions/subSchema" }
},
"dependencies": {
"exclusiveMaximum": [ "maximum" ],