diff --git a/draft-04/schema.js b/draft-04/schema.js index deb4994..46f24e9 100644 --- a/draft-04/schema.js +++ b/draft-04/schema.js @@ -206,13 +206,19 @@ of valid schemas written for this particular dialect.` "description": _enum.description }, "type": { - "anyOf": [ - { "$ref": "#/definitions/simpleTypes" }, + "type": ["string", "array"], + "allOf": [ + { + "if": { "type": "string" }, + "then": { "$ref": "#/definitions/simpleTypes" } + }, { - "type": "array", - "items": { "$ref": "#/definitions/simpleTypes" }, - "minItems": 1, - "uniqueItems": true + "if": { "type": "array" }, + "then": { + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } } ], "description": type.description diff --git a/draft-06/schema.js b/draft-06/schema.js index 216f8c6..44a373f 100644 --- a/draft-06/schema.js +++ b/draft-06/schema.js @@ -231,13 +231,19 @@ of valid schemas written for this particular dialect.` "description": _enum.description }, "type": { - "anyOf": [ - { "$ref": "#/definitions/simpleTypes" }, + "type": ["string", "array"], + "allOf": [ + { + "if": { "type": "string" }, + "then": { "$ref": "#/definitions/simpleTypes" } + }, { - "type": "array", - "items": { "$ref": "#/definitions/simpleTypes" }, - "minItems": 1, - "uniqueItems": true + "if": { "type": "array" }, + "then": { + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } } ], "description": type.description diff --git a/draft-07/schema.js b/draft-07/schema.js index 4241a26..487128b 100644 --- a/draft-07/schema.js +++ b/draft-07/schema.js @@ -255,13 +255,19 @@ of valid schemas written for this particular dialect.` "description": _enum.description }, "type": { - "anyOf": [ - { "$ref": "#/definitions/simpleTypes" }, + "type": ["string", "array"], + "allOf": [ + { + "if": { "type": "string" }, + "then": { "$ref": "#/definitions/simpleTypes" } + }, { - "type": "array", - "items": { "$ref": "#/definitions/simpleTypes" }, - "minItems": 1, - "uniqueItems": true + "if": { "type": "array" }, + "then": { + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } } ], "description": type.description diff --git a/draft-2019-09/meta/validation.js b/draft-2019-09/meta/validation.js index e6178db..7f1552e 100644 --- a/draft-2019-09/meta/validation.js +++ b/draft-2019-09/meta/validation.js @@ -109,13 +109,19 @@ export default { "description": _enum.description }, "type": { - "anyOf": [ - { "$ref": "#/$defs/simpleTypes" }, + "type": ["string", "array"], + "allOf": [ { - "type": "array", - "items": { "$ref": "#/$defs/simpleTypes" }, - "minItems": 1, - "uniqueItems": true + "if": { "type": "string" }, + "then": { "$ref": "#/$defs/simpleTypes" } + }, + { + "if": { "type": "array" }, + "then": { + "items": { "$ref": "#/$defs/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } } ], "description": type.description diff --git a/draft-2020-12/meta/validation.js b/draft-2020-12/meta/validation.js index 219cea3..6f96f89 100644 --- a/draft-2020-12/meta/validation.js +++ b/draft-2020-12/meta/validation.js @@ -111,13 +111,19 @@ export default { "description": _enum.description }, "type": { - "anyOf": [ - { "$ref": "#/$defs/simpleTypes" }, + "type": ["string", "array"], + "allOf": [ { - "type": "array", - "items": { "$ref": "#/$defs/simpleTypes" }, - "minItems": 1, - "uniqueItems": true + "if": { "type": "string" }, + "then": { "$ref": "#/$defs/simpleTypes" } + }, + { + "if": { "type": "array" }, + "then": { + "items": { "$ref": "#/$defs/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } } ], "description": type.description