diff --git a/schemas/v3.1/meta/extensions.json b/schemas/v3.1/meta/extensions.json new file mode 100644 index 0000000000..764c7905c0 --- /dev/null +++ b/schemas/v3.1/meta/extensions.json @@ -0,0 +1,118 @@ +{ + "$id": "https://spec.openapis.org/oas/3.1/meta/extensions/2019-10", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$vocabulary": { + "https://spec.openapis.org/oas/3.1/vocab/extensions/2019-10": true + }, + "$recursiveAnchor": true, + + "type": ["object", "boolean"], + "properties": { + "example": true, + "exclusiveMinimum": { + "type": ["number", "boolean"] + }, + "exclusiveMaximum": { + "type": ["number", "boolean"] + }, + "nullable": { + "type": "boolean", + "default": false + }, + "discriminator": { + "$ref": "#/$defs/Discriminator" + }, + "externalDocs": { + "$ref": "#/$defs/ExternalDocs" + }, + "xml": { + "$ref": "#/$defs/Xml" + } + }, + "patternProperties": { + "^x-": true + }, + "allOf": [ + { + "if": { + "required": ["exclusiveMinimum"], + "properties": { + "exclusiveMinimum": {"type": "boolean"} + } + }, + "then": { + "required": ["minimum"] + } + }, + { + "if": { + "required": ["exclusiveMaximum"], + "properties": { + "exclusiveMaximum": {"type": "boolean"} + } + }, + "then": { + "required": ["maximum"] + } + } + ], + "$defs": { + "Discriminator": { + "type": "object", + "required": ["propertyName"], + "properties": { + "propertyName": { + "type": "string" + }, + "mapping": { + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "ExternalDocs": { + "type": "object", + "required": ["url"], + "properties": { + "url": { + "type": "string", + "format": "uri-reference" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": true + }, + "additionalProperties": false + }, + "Xml": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string", + "format": "uri" + }, + "prefix": { + "type": "string" + }, + "attribute": { + "type": "boolean" + }, + "wrapped": { + "type": "boolean" + } + }, + "patternProperties": { + "^x-": true + }, + "additionalProperties": false + } + } +} diff --git a/schemas/v3.1/meta/schema-object.json b/schemas/v3.1/meta/schema-object.json new file mode 100644 index 0000000000..fd3047380e --- /dev/null +++ b/schemas/v3.1/meta/schema-object.json @@ -0,0 +1,28 @@ +{ + "$id": "https://spec.openapis.org/oas/3.1/meta/schema-object/2019-10", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true, + "https://spec.openapis.org/oas/3.1/vocab/extensions/2019-10": true + }, + "$recursiveAnchor": true, + + "title": "Core and Validation specifications meta-schema", + "$comment": "Note that while the standard validation vocabulary is used, an alternate meta-schema for that vocabulary is used in order to faciliate compatibility with past versions of the OpenAPI Specification.", + "allOf": [ + {"$ref": "https://json-schema.org/draft/2019-09/core"}, + {"$ref": "https://json-schema.org/draft/2019-09/applicator"}, + {"$ref": "https://json-schema.org/draft/2019-09/meta-data"}, + {"$ref": "https://json-schema.org/draft/2019-09/format"}, + {"$ref": "https://json-schema.org/draft/2019-09/content"}, + {"$ref": "https://spec.openapis.org/oas/3.1/meta/validation/2019-10"}, + {"$ref": "https://spec.openapis.org/oas/3.1/meta/extensions/2019-10"} + ], + "type": ["object", "boolean"], + "unevaluatedProperties": false +} diff --git a/schemas/v3.1/meta/validation.json b/schemas/v3.1/meta/validation.json new file mode 100644 index 0000000000..1489472801 --- /dev/null +++ b/schemas/v3.1/meta/validation.json @@ -0,0 +1,94 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://spec.openapis.org/oas/3.1/meta/validation/2019-10", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/validation": true + }, + "$recursiveAnchor": true, + + "$comment": "This is an alternate meta-schema for the standard validation vocabulary. It is identical to the standard validation meta-schema except that it omits exclusiveMinimum and exclusiveMaximum, which are described by the OpenAPI extensions meta-schema.", + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/$defs/nonNegativeInteger" }, + "minLength": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": { "$ref": "#/$defs/nonNegativeInteger" }, + "minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": { "$ref": "#/$defs/nonNegativeInteger" }, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": { "$ref": "#/$defs/nonNegativeInteger" }, + "minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/$defs/stringArray" }, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "type": { + "anyOf": [ + { "$ref": "#/$defs/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/$defs/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + } +}