From ddcab423f5d440f4574d5c37eea8daab864806ef Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 5 Oct 2023 09:30:03 -0700 Subject: [PATCH] refactor out a common definition when style=form (#3379) --- schemas/v3.1/schema.json | 86 ++++++++++++++-------------------------- schemas/v3.1/schema.yaml | 54 +++++++++---------------- 2 files changed, 48 insertions(+), 92 deletions(-) diff --git a/schemas/v3.1/schema.json b/schemas/v3.1/schema.json index edd6d573fb..3fe58f2623 100644 --- a/schemas/v3.1/schema.json +++ b/schemas/v3.1/schema.json @@ -535,7 +535,7 @@ "$ref": "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie" }, { - "$ref": "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form" + "$ref": "#/$defs/styles-for-form" } ], "$defs": { @@ -640,32 +640,6 @@ } } } - }, - "styles-for-form": { - "if": { - "properties": { - "style": { - "const": "form" - } - }, - "required": [ - "style" - ] - }, - "then": { - "properties": { - "explode": { - "default": true - } - } - }, - "else": { - "properties": { - "explode": { - "default": false - } - } - } } } } @@ -792,38 +766,10 @@ "$ref": "#/$defs/specification-extensions" }, { - "$ref": "#/$defs/encoding/$defs/explode-default" + "$ref": "#/$defs/styles-for-form" } ], - "unevaluatedProperties": false, - "$defs": { - "explode-default": { - "if": { - "properties": { - "style": { - "const": "form" - } - }, - "required": [ - "style" - ] - }, - "then": { - "properties": { - "explode": { - "default": true - } - } - }, - "else": { - "properties": { - "explode": { - "default": false - } - } - } - } - } + "unevaluatedProperties": false }, "responses": { "$comment": "https://spec.openapis.org/oas/v3.1.0#responses-object", @@ -1444,6 +1390,32 @@ "additionalProperties": { "type": "string" } + }, + "styles-for-form": { + "if": { + "properties": { + "style": { + "const": "form" + } + }, + "required": [ + "style" + ] + }, + "then": { + "properties": { + "explode": { + "default": true + } + } + }, + "else": { + "properties": { + "explode": { + "default": false + } + } + } } } } diff --git a/schemas/v3.1/schema.yaml b/schemas/v3.1/schema.yaml index 92b8d52c26..791f53dfde 100644 --- a/schemas/v3.1/schema.yaml +++ b/schemas/v3.1/schema.yaml @@ -369,7 +369,7 @@ $defs: - $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header' - $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query' - $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie' - - $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form' + - $ref: '#/$defs/styles-for-form' $defs: styles-for-path: @@ -426,6 +426,7 @@ $defs: allowReserved: default: false type: boolean + styles-for-cookie: if: properties: @@ -439,22 +440,6 @@ $defs: default: form const: form - styles-for-form: - if: - properties: - style: - const: form - required: - - style - then: - properties: - explode: - default: true - else: - properties: - explode: - default: false - $ref: '#/$defs/specification-extensions' unevaluatedProperties: false @@ -542,26 +527,9 @@ $defs: type: boolean allOf: - $ref: '#/$defs/specification-extensions' - - $ref: '#/$defs/encoding/$defs/explode-default' + - $ref: '#/$defs/styles-for-form' unevaluatedProperties: false - $defs: - explode-default: - if: - properties: - style: - const: form - required: - - style - then: - properties: - explode: - default: true - else: - properties: - explode: - default: false - responses: $comment: https://spec.openapis.org/oas/v3.1.0#responses-object type: object @@ -999,3 +967,19 @@ $defs: type: object additionalProperties: type: string + + styles-for-form: + if: + properties: + style: + const: form + required: + - style + then: + properties: + explode: + default: true + else: + properties: + explode: + default: false