From a1facce1b3621df3630cb692e9fbe18a7612ea6d Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Thu, 10 Mar 2022 09:23:08 -0800 Subject: [PATCH] Bump schema version numbers for 2022-02-17 release (#2888) --- schemas/v3.1/dialect/base.schema.json | 7 +++-- schemas/v3.1/dialect/base.schema.yaml | 13 +++++--- schemas/v3.1/meta/base.schema.json | 11 +++++-- schemas/v3.1/meta/base.schema.yaml | 44 +++++++++++++++------------ schemas/v3.1/schema-base.json | 24 +++++++-------- schemas/v3.1/schema-base.yaml | 8 +++-- schemas/v3.1/schema.json | 4 +-- schemas/v3.1/schema.yaml | 5 +-- scripts/validate.js | 2 +- tests/v3.1/test.js | 2 +- 10 files changed, 70 insertions(+), 50 deletions(-) diff --git a/schemas/v3.1/dialect/base.schema.json b/schemas/v3.1/dialect/base.schema.json index 762574d..eae8386 100644 --- a/schemas/v3.1/dialect/base.schema.json +++ b/schemas/v3.1/dialect/base.schema.json @@ -1,8 +1,10 @@ { - "title": "OpenAPI 3.1 Schema Object Dialect", - "description": "A JSON Schema dialect describing schemas found in OpenAPI documents", "$id": "https://spec.openapis.org/oas/3.1/dialect/base", "$schema": "https://json-schema.org/draft/2020-12/schema", + + "title": "OpenAPI 3.1 Schema Object Dialect", + "description": "A JSON Schema dialect describing schemas found in OpenAPI documents", + "$vocabulary": { "https://json-schema.org/draft/2020-12/vocab/core": true, "https://json-schema.org/draft/2020-12/vocab/applicator": true, @@ -13,6 +15,7 @@ "https://json-schema.org/draft/2020-12/vocab/content": true, "https://spec.openapis.org/oas/3.1/vocab/base": false }, + "$dynamicAnchor": "meta", "allOf": [ diff --git a/schemas/v3.1/dialect/base.schema.yaml b/schemas/v3.1/dialect/base.schema.yaml index 81d42a7..30996ab 100644 --- a/schemas/v3.1/dialect/base.schema.yaml +++ b/schemas/v3.1/dialect/base.schema.yaml @@ -1,9 +1,11 @@ ---- +$id: https://spec.openapis.org/oas/3.1/dialect/base +$schema: https://json-schema.org/draft/2020-12/schema + title: OpenAPI 3.1 Schema Object Dialect description: A JSON Schema dialect describing schemas found in OpenAPI documents + $dynamicAnchor: meta -$id: https://spec.openapis.org/oas/3.1/dialect/base -$schema: https://json-schema.org/draft/2020-12/schema + $vocabulary: https://json-schema.org/draft/2020-12/vocab/applicator: true https://json-schema.org/draft/2020-12/vocab/content: true @@ -13,6 +15,7 @@ $vocabulary: https://json-schema.org/draft/2020-12/vocab/unevaluated: true https://json-schema.org/draft/2020-12/vocab/validation: true https://spec.openapis.org/oas/3.1/vocab/base: false + allOf: -- $ref: https://json-schema.org/draft/2020-12/schema -- $ref: https://spec.openapis.org/oas/3.1/meta/base + - $ref: https://json-schema.org/draft/2020-12/schema + - $ref: https://spec.openapis.org/oas/3.1/meta/base diff --git a/schemas/v3.1/meta/base.schema.json b/schemas/v3.1/meta/base.schema.json index c3b2fea..a7a59f1 100644 --- a/schemas/v3.1/meta/base.schema.json +++ b/schemas/v3.1/meta/base.schema.json @@ -1,11 +1,14 @@ { - "title": "OAS Base vocabulary", - "description": "A JSON Schema Vocabulary used in the OpenAPI Schema Dialect", "$id": "https://spec.openapis.org/oas/3.1/meta/base", "$schema": "https://json-schema.org/draft/2020-12/schema", + + "title": "OAS Base vocabulary", + "description": "A JSON Schema Vocabulary used in the OpenAPI Schema Dialect", + "$vocabulary": { "https://spec.openapis.org/oas/3.1/vocab/base": true }, + "$dynamicAnchor": "meta", "type": ["object", "boolean"], @@ -15,12 +18,14 @@ "externalDocs": { "$ref": "#/$defs/external-docs" }, "xml": { "$ref": "#/$defs/xml" } }, + "$defs": { "extensible": { "patternProperties": { "^x-": true } }, + "discriminator": { "$ref": "#/$defs/extensible", "type": "object", @@ -38,6 +43,7 @@ "required": ["propertyName"], "unevaluatedProperties": false }, + "external-docs": { "$ref": "#/$defs/extensible", "type": "object", @@ -53,6 +59,7 @@ "required": ["url"], "unevaluatedProperties": false }, + "xml": { "$ref": "#/$defs/extensible", "type": "object", diff --git a/schemas/v3.1/meta/base.schema.yaml b/schemas/v3.1/meta/base.schema.yaml index a0de79c..e2849e4 100644 --- a/schemas/v3.1/meta/base.schema.yaml +++ b/schemas/v3.1/meta/base.schema.yaml @@ -1,6 +1,26 @@ ---- +$id: https://spec.openapis.org/oas/3.1/meta/base +$schema: https://json-schema.org/draft/2020-12/schema + title: OAS Base vocabulary description: A JSON Schema Vocabulary used in the OpenAPI Schema Dialect + +$dynamicAnchor: meta + +$vocabulary: + https://spec.openapis.org/oas/3.1/vocab/base: true + +type: + - object + - boolean +properties: + discriminator: + $ref: '#/$defs/discriminator' + example: true + externalDocs: + $ref: '#/$defs/external-docs' + xml: + $ref: '#/$defs/xml' + $defs: discriminator: $ref: '#/$defs/extensible' @@ -12,9 +32,10 @@ $defs: propertyName: type: string required: - - propertyName + - propertyName type: object unevaluatedProperties: false + extensible: patternProperties: ^x-: true @@ -27,9 +48,10 @@ $defs: format: uri-reference type: string required: - - url + - url type: object unevaluatedProperties: false + xml: $ref: '#/$defs/extensible' properties: @@ -46,19 +68,3 @@ $defs: type: boolean type: object unevaluatedProperties: false -$dynamicAnchor: meta -$id: https://spec.openapis.org/oas/3.1/meta/base -$schema: https://json-schema.org/draft/2020-12/schema -$vocabulary: - https://spec.openapis.org/oas/3.1/vocab/base: true -properties: - discriminator: - $ref: '#/$defs/discriminator' - example: true - externalDocs: - $ref: '#/$defs/external-docs' - xml: - $ref: '#/$defs/xml' -type: -- object -- boolean diff --git a/schemas/v3.1/schema-base.json b/schemas/v3.1/schema-base.json index c1855b5..04c9f60 100644 --- a/schemas/v3.1/schema-base.json +++ b/schemas/v3.1/schema-base.json @@ -1,25 +1,23 @@ { - "description": "The description of OpenAPI v3.1.x documents using the OpenAPI JSON Schema dialect, as defined by https://spec.openapis.org/oas/v3.1.0", - "$id": "https://spec.openapis.org/oas/3.1/schema-base/2021-09-28", + "$id": "https://spec.openapis.org/oas/3.1/schema-base/2022-02-27", "$schema": "https://json-schema.org/draft/2020-12/schema", - "$ref": "https://spec.openapis.org/oas/3.1/schema/2021-09-28", + + "description": "The description of OpenAPI v3.1.x documents using the OpenAPI JSON Schema dialect, as defined by https://spec.openapis.org/oas/v3.1.0", + + "$ref": "https://spec.openapis.org/oas/3.1/schema/2022-02-27", "properties": { - "jsonSchemaDialect": { - "$ref": "#/$defs/dialect" - } + "jsonSchemaDialect": { "$ref": "#/$defs/dialect" } }, + "$defs": { - "dialect": { - "const": "https://spec.openapis.org/oas/3.1/dialect/base" - }, + "dialect": { "const": "https://spec.openapis.org/oas/3.1/dialect/base" }, + "schema": { "$dynamicAnchor": "meta", "$ref": "https://spec.openapis.org/oas/3.1/dialect/base", "properties": { - "$schema": { - "$ref": "#/$defs/dialect" - } + "$schema": { "$ref": "#/$defs/dialect" } } } } -} \ No newline at end of file +} diff --git a/schemas/v3.1/schema-base.yaml b/schemas/v3.1/schema-base.yaml index b0360a7..d4fa536 100644 --- a/schemas/v3.1/schema-base.yaml +++ b/schemas/v3.1/schema-base.yaml @@ -1,8 +1,9 @@ -description: The description of OpenAPI v3.1.x documents using the OpenAPI JSON Schema dialect, as defined by https://spec.openapis.org/oas/v3.1.0 -$id: 'https://spec.openapis.org/oas/3.1/schema-base/2021-09-28' +$id: 'https://spec.openapis.org/oas/3.1/schema-base/2022-02-27' $schema: 'https://json-schema.org/draft/2020-12/schema' -$ref: 'https://spec.openapis.org/oas/3.1/schema/2021-09-28' +description: The description of OpenAPI v3.1.x documents using the OpenAPI JSON Schema dialect, as defined by https://spec.openapis.org/oas/v3.1.0 + +$ref: 'https://spec.openapis.org/oas/3.1/schema/2022-02-27' properties: jsonSchemaDialect: $ref: '#/$defs/dialect' @@ -10,6 +11,7 @@ properties: $defs: dialect: const: 'https://spec.openapis.org/oas/3.1/dialect/base' + schema: $dynamicAnchor: meta $ref: 'https://spec.openapis.org/oas/3.1/dialect/base' diff --git a/schemas/v3.1/schema.json b/schemas/v3.1/schema.json index 576e43f..ed0fd49 100644 --- a/schemas/v3.1/schema.json +++ b/schemas/v3.1/schema.json @@ -1,7 +1,7 @@ { - "description": "The description of OpenAPI v3.1.x documents without schema validation, as defined by https://spec.openapis.org/oas/v3.1.0", - "$id": "https://spec.openapis.org/oas/3.1/schema/2021-09-28", + "$id": "https://spec.openapis.org/oas/3.1/schema/2022-02-27", "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "The description of OpenAPI v3.1.x documents without schema validation, as defined by https://spec.openapis.org/oas/v3.1.0", "type": "object", "properties": { "openapi": { diff --git a/schemas/v3.1/schema.yaml b/schemas/v3.1/schema.yaml index 6e05f65..64fa752 100644 --- a/schemas/v3.1/schema.yaml +++ b/schemas/v3.1/schema.yaml @@ -1,7 +1,8 @@ -description: The description of OpenAPI v3.1.x documents without schema validation, as defined by https://spec.openapis.org/oas/v3.1.0 -$id: 'https://spec.openapis.org/oas/3.1/schema/2021-09-28' +$id: 'https://spec.openapis.org/oas/3.1/schema/2022-02-27' $schema: 'https://json-schema.org/draft/2020-12/schema' +description: The description of OpenAPI v3.1.x documents without schema validation, as defined by https://spec.openapis.org/oas/v3.1.0 + type: object properties: openapi: diff --git a/scripts/validate.js b/scripts/validate.js index c9c70db..37446ce 100755 --- a/scripts/validate.js +++ b/scripts/validate.js @@ -25,7 +25,7 @@ const args = process.argv.reduce((acc, arg) => { (async function () { try { const schemaType = args.schema || "schema"; - const schemaVersion = args.version || "2021-03-02"; + const schemaVersion = args.version || "2022-02-27"; const outputFormat = args.format || JsonSchema.BASIC; // Config diff --git a/tests/v3.1/test.js b/tests/v3.1/test.js index 5e9dc31..e7679f5 100644 --- a/tests/v3.1/test.js +++ b/tests/v3.1/test.js @@ -14,7 +14,7 @@ before(async () => { JsonSchema.add(dialect); JsonSchema.add(vocabulary); JsonSchema.add(yaml.parse(fs.readFileSync(`${__dirname}/../../schemas/v3.1/schema.yaml`, "utf8"), { prettyErrors: true })); - metaSchema = await JsonSchema.get("https://spec.openapis.org/oas/3.1/schema/2021-09-28"); + metaSchema = await JsonSchema.get("https://spec.openapis.org/oas/3.1/schema/2022-02-27"); }); describe("v3.1 Pass", () => { -- GitLab