diff --git a/hyper-schema.json b/hyper-schema.json index b633bd50..204def3e 100644 --- a/hyper-schema.json +++ b/hyper-schema.json @@ -7,7 +7,7 @@ "allOf": [ { "$ref": "http://json-schema.org/drafts/schema" }, { - "items": { "$ref": "#" } + "items": { "$ref": "#/definitions/subSchema" } } ] }, @@ -30,7 +30,7 @@ }, "targetSchema": { "description": "JSON Schema describing the link target", - "allOf": [ { "$ref": "#" } ] + "allOf": [ { "$ref": "#/definitions/subSchema" } ] }, "mediaType": { "description": "media type (as defined by RFC 2046) describing the link target", @@ -47,52 +47,64 @@ }, "schema": { "description": "Schema describing the data to submit along with the request", - "allOf": [ { "$ref": "#" } ] + "allOf": [ { "$ref": "#/definitions/subSchema" } ] } } + }, + "subSchema": { + "oneOf": [ + { + "allOf": [ + { "$ref": "#" }, + { "$ref": "http://json-schema.org/draft/schema#/definitions/notJsonReference" } + ] + }, + { "$ref": "http://json-schema.org/draft/schema#/definitions/jsonReference" } + ] } }, + "allOf": [ { "$ref": "http://json-schema.org/draft/schema#" } ], "properties": { "additionalItems": { "anyOf": [ { "type": "boolean" }, - { "$ref": "#" } + { "$ref": "#/definitions/subSchema" } ] }, "additionalProperties": { "anyOf": [ { "type": "boolean" }, - { "$ref": "#" } + { "$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" }, "base": { "description": "URI Template resolved as for the 'href' keyword in the Link Description Object. The resulting URI Reference is resolved against the current URI base and sets the new URI base for URI references within the instance.", diff --git a/schema.json b/schema.json index 15502e9b..79e63af0 100644 --- a/schema.json +++ b/schema.json @@ -3,10 +3,25 @@ "id": "http://json-schema.org/draft/schema#", "title": "Core schema meta-schema", "definitions": { + "jsonReference": { + "type": "object", + "properties": { + "$ref": { + "type": "string", + "format": "uriref" + } + }, + "required": [ "$ref" ] + }, + "notJsonReference": { + "not": { + "required": [ "$ref" ] + } + }, "schemaArray": { "type": "array", "minItems": 1, - "items": { "$ref": "#" } + "items": { "$ref": "#/definitions/subSchema" } }, "positiveInteger": { "type": "integer", @@ -33,6 +48,17 @@ "type": "array", "items": { "type": "string" }, "uniqueItems": true + }, + "subSchema": { + "oneOf": [ + { + "allOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/notJsonReference" } + ] + }, + { "$ref": "#/definitions/jsonReference" } + ] } }, "type": ["object", "boolean"], @@ -77,10 +103,10 @@ "type": "string", "format": "regex" }, - "additionalItems": { "$ref": "#" }, + "additionalItems": { "$ref": "#/definitions/subSchema" }, "items": { "anyOf": [ - { "$ref": "#" }, + { "$ref": "#/definitions/subSchema" }, { "$ref": "#/definitions/schemaArray" } ], "default": {} @@ -95,27 +121,27 @@ "maxProperties": { "$ref": "#/definitions/positiveInteger" }, "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, "required": { "$ref": "#/definitions/stringArray" }, - "additionalProperties": { "$ref": "#" }, + "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" } ] } @@ -142,7 +168,7 @@ "allOf": { "$ref": "#/definitions/schemaArray" }, "anyOf": { "$ref": "#/definitions/schemaArray" }, "oneOf": { "$ref": "#/definitions/schemaArray" }, - "not": { "$ref": "#" } + "not": { "$ref": "#/definitions/subSchema" } }, "dependencies": { "exclusiveMaximum": [ "maximum" ],