From 74c5bb0ab129c90fe1c84ad29654b255c18ee7f4 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 6 Aug 2021 14:28:17 -0700 Subject: [PATCH 1/4] minor simplification of v3.1 schema "if the X property is present, then apply this constraint to property X" can be simplified by simply stating the constraint for property X. --- schemas/v3.1/schema.json | 16 ++++++---------- schemas/v3.1/schema.yaml | 10 ++++------ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/schemas/v3.1/schema.json b/schemas/v3.1/schema.json index 44fdbb92b8..10b6948168 100644 --- a/schemas/v3.1/schema.json +++ b/schemas/v3.1/schema.json @@ -937,6 +937,12 @@ "allowEmptyValue": { "default": false, "type": "boolean" + }, + "schema": { + "$dynamicRef": "#meta" + }, + "content": { + "$ref": "#/$defs/content" } }, "dependentSchemas": { @@ -955,19 +961,9 @@ "allowReserved": { "default": false, "type": "boolean" - }, - "schema": { - "$dynamicRef": "#meta" } }, "$ref": "#/$defs/examples" - }, - "content": { - "properties": { - "content": { - "$ref": "#/$defs/content" - } - } } }, "$ref": "#/$defs/specification-extensions", diff --git a/schemas/v3.1/schema.yaml b/schemas/v3.1/schema.yaml index 39b90f34de..226c870b1e 100644 --- a/schemas/v3.1/schema.yaml +++ b/schemas/v3.1/schema.yaml @@ -637,6 +637,10 @@ $defs: allowEmptyValue: default: false type: boolean + schema: + $dynamicRef: '#meta' + content: + $ref: '#/$defs/content' dependentSchemas: schema: properties: @@ -650,13 +654,7 @@ $defs: allowReserved: default: false type: boolean - schema: - $dynamicRef: '#meta' $ref: '#/$defs/examples' - content: - properties: - content: - $ref: '#/$defs/content' $ref: '#/$defs/specification-extensions' unevaluatedProperties: false From 5c89b8c34e28967f28f9648a6b7e4b37b95475ad Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 10 Aug 2021 15:55:13 -0700 Subject: [PATCH 2/4] add missing constraint to "header" https://spec.openapis.org/oas/v3.1.0#headerObject --- schemas/v3.1/schema.json | 12 ++++++++++++ schemas/v3.1/schema.yaml | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/schemas/v3.1/schema.json b/schemas/v3.1/schema.json index 10b6948168..4af0dd61c2 100644 --- a/schemas/v3.1/schema.json +++ b/schemas/v3.1/schema.json @@ -945,6 +945,18 @@ "$ref": "#/$defs/content" } }, + "oneOf": [ + { + "required": [ + "schema" + ] + }, + { + "required": [ + "content" + ] + } + ], "dependentSchemas": { "schema": { "properties": { diff --git a/schemas/v3.1/schema.yaml b/schemas/v3.1/schema.yaml index 226c870b1e..1b0da769ca 100644 --- a/schemas/v3.1/schema.yaml +++ b/schemas/v3.1/schema.yaml @@ -641,6 +641,11 @@ $defs: $dynamicRef: '#meta' content: $ref: '#/$defs/content' + oneOf: + - required: + - schema + - required: + - content dependentSchemas: schema: properties: From 25ca57f43fb5d8c83f1fe20d23990b71b72a31a2 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 10 Aug 2021 15:57:12 -0700 Subject: [PATCH 3/4] allowEmptyValue and allowReserved don't make sense for headers --- schemas/v3.1/schema.json | 8 -------- schemas/v3.1/schema.yaml | 6 ------ 2 files changed, 14 deletions(-) diff --git a/schemas/v3.1/schema.json b/schemas/v3.1/schema.json index 4af0dd61c2..7519b5cc2f 100644 --- a/schemas/v3.1/schema.json +++ b/schemas/v3.1/schema.json @@ -934,10 +934,6 @@ "default": false, "type": "boolean" }, - "allowEmptyValue": { - "default": false, - "type": "boolean" - }, "schema": { "$dynamicRef": "#meta" }, @@ -969,10 +965,6 @@ "explode": { "default": false, "type": "boolean" - }, - "allowReserved": { - "default": false, - "type": "boolean" } }, "$ref": "#/$defs/examples" diff --git a/schemas/v3.1/schema.yaml b/schemas/v3.1/schema.yaml index 1b0da769ca..8e6ddeedc0 100644 --- a/schemas/v3.1/schema.yaml +++ b/schemas/v3.1/schema.yaml @@ -634,9 +634,6 @@ $defs: deprecated: default: false type: boolean - allowEmptyValue: - default: false - type: boolean schema: $dynamicRef: '#meta' content: @@ -656,9 +653,6 @@ $defs: explode: default: false type: boolean - allowReserved: - default: false - type: boolean $ref: '#/$defs/examples' $ref: '#/$defs/specification-extensions' unevaluatedProperties: false From cb62dcb261fcecf067554c24282699b5837c7fcc Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 14 Sep 2021 11:41:19 -0700 Subject: [PATCH 4/4] collapse single-item "enum"s in "cookie" and "header" to "const" --- schemas/v3.1/schema.json | 12 +++--------- schemas/v3.1/schema.yaml | 9 +++------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/schemas/v3.1/schema.json b/schemas/v3.1/schema.json index 7519b5cc2f..cf0cf085d9 100644 --- a/schemas/v3.1/schema.json +++ b/schemas/v3.1/schema.json @@ -534,9 +534,7 @@ "properties": { "style": { "default": "simple", - "enum": [ - "simple" - ] + "const": "simple" } } } @@ -581,9 +579,7 @@ "properties": { "style": { "default": "form", - "enum": [ - "form" - ] + "const": "form" } } } @@ -958,9 +954,7 @@ "properties": { "style": { "default": "simple", - "enum": [ - "simple" - ] + "const": "simple" }, "explode": { "default": false, diff --git a/schemas/v3.1/schema.yaml b/schemas/v3.1/schema.yaml index 8e6ddeedc0..cec4b6b1ca 100644 --- a/schemas/v3.1/schema.yaml +++ b/schemas/v3.1/schema.yaml @@ -363,8 +363,7 @@ $defs: properties: style: default: simple - enum: - - simple + const: simple styles-for-query: if: @@ -394,8 +393,7 @@ $defs: properties: style: default: form - enum: - - form + const: form styles-for-form: if: @@ -648,8 +646,7 @@ $defs: properties: style: default: simple - enum: - - simple + const: simple explode: default: false type: boolean