From 4e1877b2fa2bcd2bc66f44639db0fd30cb1e81e9 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Sun, 31 Aug 2025 16:00:23 -0700 Subject: [PATCH 1/9] pull out subschemas that do not need to be in an allOf --- src/schemas/validation/schema.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/schemas/validation/schema.yaml b/src/schemas/validation/schema.yaml index 0717e2632f..aad593c73b 100644 --- a/src/schemas/validation/schema.yaml +++ b/src/schemas/validation/schema.yaml @@ -539,14 +539,14 @@ $defs: $ref: '#/$defs/encoding' itemEncoding: $ref: '#/$defs/encoding' + dependentSchemas: + encoding: + properties: + prefixEncoding: false + itemEncoding: false allOf: - $ref: '#/$defs/examples' - $ref: '#/$defs/specification-extensions' - - dependentSchemas: - encoding: - properties: - prefixEncoding: false - itemEncoding: false unevaluatedProperties: false media-type-or-reference: @@ -592,14 +592,14 @@ $defs: $ref: '#/$defs/encoding' itemEncoding: $ref: '#/$defs/encoding' + dependentSchemas: + encoding: + properties: + prefixEncoding: false + itemEncoding: false allOf: - $ref: '#/$defs/specification-extensions' - $ref: '#/$defs/styles-for-form' - - dependentSchemas: - encoding: - properties: - prefixEncoding: false - itemEncoding: false unevaluatedProperties: false responses: From 2773541eec70ee8d0a64832196f2bfb5508a1ffe Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 4 Sep 2025 17:50:30 -0700 Subject: [PATCH 2/9] remove redundant $ref: examples are allowed in "content" now too --- src/schemas/validation/schema.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/schemas/validation/schema.yaml b/src/schemas/validation/schema.yaml index aad593c73b..97c703036d 100644 --- a/src/schemas/validation/schema.yaml +++ b/src/schemas/validation/schema.yaml @@ -783,7 +783,6 @@ $defs: allowReserved: default: false type: boolean - $ref: '#/$defs/examples' allOf: - $ref: '#/$defs/examples' - $ref: '#/$defs/specification-extensions' From 3c675a81a8c2b0dd3a64bf8e3422cdc9d30916f5 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Sat, 6 Sep 2025 11:15:32 -0700 Subject: [PATCH 3/9] use non-capturing parentheses everywhere --- src/schemas/validation/schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schemas/validation/schema.yaml b/src/schemas/validation/schema.yaml index 97c703036d..4a96786465 100644 --- a/src/schemas/validation/schema.yaml +++ b/src/schemas/validation/schema.yaml @@ -204,7 +204,7 @@ $defs: additionalProperties: $ref: '#/$defs/media-type-or-reference' patternProperties: - '^(schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems|mediaTypes)$': + '^(?:schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems|mediaTypes)$': $comment: Enumerating all of the property names in the regex above is necessary for unevaluatedProperties to work as expected propertyNames: pattern: '^[a-zA-Z0-9._-]+$' From 9ac8910371dbfc30e74eda7d04c63e347a7e0247 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 12 Sep 2025 15:47:55 -0700 Subject: [PATCH 4/9] remove redundant "requires" - "in" is always required for "parameter" - "type" is required for "security-scheme" --- src/schemas/validation/schema.yaml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/schemas/validation/schema.yaml b/src/schemas/validation/schema.yaml index 4a96786465..2171b2b948 100644 --- a/src/schemas/validation/schema.yaml +++ b/src/schemas/validation/schema.yaml @@ -376,8 +376,6 @@ $defs: properties: in: const: query - required: - - in then: properties: allowEmptyValue: @@ -387,8 +385,6 @@ $defs: properties: in: const: querystring - required: - - in then: required: - content @@ -415,8 +411,6 @@ $defs: properties: in: const: path - required: - - in then: properties: style: @@ -435,8 +429,6 @@ $defs: properties: in: const: header - required: - - in then: properties: style: @@ -448,8 +440,6 @@ $defs: properties: in: const: query - required: - - in then: properties: style: @@ -465,8 +455,6 @@ $defs: properties: in: const: cookie - required: - - in then: properties: style: @@ -871,8 +859,6 @@ $defs: properties: type: const: apiKey - required: - - type then: properties: name: @@ -891,8 +877,6 @@ $defs: properties: type: const: http - required: - - type then: properties: scheme: @@ -921,8 +905,6 @@ $defs: properties: type: const: oauth2 - required: - - type then: properties: flows: @@ -938,8 +920,6 @@ $defs: properties: type: const: openIdConnect - required: - - type then: properties: openIdConnectUrl: From c4673bcdc536fc0bf28ce4320e9bd7e8aa0a788b Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 12 Sep 2025 16:56:07 -0700 Subject: [PATCH 5/9] whitespace --- tests/schema/fail/example-examples.yaml | 3 --- tests/schema/fail/invalid_schema_types.yaml | 1 - tests/schema/pass/example-object-examples.yaml | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/schema/fail/example-examples.yaml b/tests/schema/fail/example-examples.yaml index eb91f13338..aa8227817d 100644 --- a/tests/schema/fail/example-examples.yaml +++ b/tests/schema/fail/example-examples.yaml @@ -15,6 +15,3 @@ components: examples: a mammalian example: dataValue: bear - - - diff --git a/tests/schema/fail/invalid_schema_types.yaml b/tests/schema/fail/invalid_schema_types.yaml index ae51ad083e..b3aa50a6c8 100644 --- a/tests/schema/fail/invalid_schema_types.yaml +++ b/tests/schema/fail/invalid_schema_types.yaml @@ -10,4 +10,3 @@ components: invalid_null: null invalid_number: 0 invalid_array: [] - diff --git a/tests/schema/pass/example-object-examples.yaml b/tests/schema/pass/example-object-examples.yaml index 5971028051..af8cc255f0 100644 --- a/tests/schema/pass/example-object-examples.yaml +++ b/tests/schema/pass/example-object-examples.yaml @@ -29,7 +29,7 @@ components: summary: This is a text example externalValue: https://foo.bar/examples/address-example.txt parameters: - with-example: + with-example: name: zipCode in: query schema: From c602ca697e2bb2a916e5ff6df16d187a6b6c5c0d Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 12 Sep 2025 16:11:19 -0700 Subject: [PATCH 6/9] remove confusing use of json within yaml --- tests/schema/pass/parameter-object-examples.yaml | 7 +++---- .../pass/schema-object-deprecated-example-keyword.yaml | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/schema/pass/parameter-object-examples.yaml b/tests/schema/pass/parameter-object-examples.yaml index ab5a00e612..f85161f0e3 100644 --- a/tests/schema/pass/parameter-object-examples.yaml +++ b/tests/schema/pass/parameter-object-examples.yaml @@ -62,7 +62,6 @@ paths: # Allow an arbitrary JSON object to keep # the example simple type: object - example: { - "numbers": [1, 2], - "flag": null - } \ No newline at end of file + example: + numbers: [1, 2] + flag: null diff --git a/tests/schema/pass/schema-object-deprecated-example-keyword.yaml b/tests/schema/pass/schema-object-deprecated-example-keyword.yaml index 8a928c5a55..969e66f283 100644 --- a/tests/schema/pass/schema-object-deprecated-example-keyword.yaml +++ b/tests/schema/pass/schema-object-deprecated-example-keyword.yaml @@ -12,7 +12,6 @@ paths: # the example simple type: object # DEPRECATED: don't use example keyword inside Schema Object - example: { - "numbers": [1, 2], - "flag": null - } + example: + numbers: [1, 2] + flag: null From 14528c99a90a45be70e5c12aa957ae14594e1b62 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Sun, 31 Aug 2025 16:07:00 -0700 Subject: [PATCH 7/9] query and querystring are mutually exclusive; disallow more than one querystring --- src/schemas/validation/schema.yaml | 38 ++++++++++++++++--- ...eration-object-query-with-querystring.yaml | 20 ++++++++++ .../operation-object-two-querystrings.yaml | 20 ++++++++++ ...th-item-object-query-with-querystring.yaml | 19 ++++++++++ .../path-item-object-two-querystrings.yaml | 20 ++++++++++ 5 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 tests/schema/fail/operation-object-query-with-querystring.yaml create mode 100644 tests/schema/fail/operation-object-two-querystrings.yaml create mode 100644 tests/schema/fail/path-item-object-query-with-querystring.yaml create mode 100644 tests/schema/fail/path-item-object-two-querystrings.yaml diff --git a/src/schemas/validation/schema.yaml b/src/schemas/validation/schema.yaml index 2171b2b948..4438182897 100644 --- a/src/schemas/validation/schema.yaml +++ b/src/schemas/validation/schema.yaml @@ -236,9 +236,7 @@ $defs: items: $ref: '#/$defs/server' parameters: - type: array - items: - $ref: '#/$defs/parameter-or-reference' + $ref: '#/$defs/parameters' additionalOperations: type: object additionalProperties: @@ -295,9 +293,7 @@ $defs: operationId: type: string parameters: - type: array - items: - $ref: '#/$defs/parameter-or-reference' + $ref: '#/$defs/parameters' requestBody: $ref: '#/$defs/request-body-or-reference' responses: @@ -334,6 +330,36 @@ $defs: $ref: '#/$defs/specification-extensions' unevaluatedProperties: false + parameters: + type: array + items: + $ref: '#/$defs/parameter-or-reference' + not: + allOf: + - contains: + type: object + properties: + in: + const: query + required: + - in + - contains: + type: object + properties: + in: + const: querystring + required: + - in + contains: + type: object + properties: + in: + const: querystring + required: + - in + minContains: 0 + maxContains: 1 + parameter: $comment: https://spec.openapis.org/oas/v3.2#parameter-object type: object diff --git a/tests/schema/fail/operation-object-query-with-querystring.yaml b/tests/schema/fail/operation-object-query-with-querystring.yaml new file mode 100644 index 0000000000..5046d9c73c --- /dev/null +++ b/tests/schema/fail/operation-object-query-with-querystring.yaml @@ -0,0 +1,20 @@ +openapi: 3.2.0 +info: + title: API + version: 1.0.0 +components: + pathItems: + my-path-item: + get: + description: a query parameter cannot be used together with a querystring parameter + parameters: + - name: myquerystring + in: querystring + content: + application/json: + schema: + type: string + - name: myquery + in: query + schema: + type: string diff --git a/tests/schema/fail/operation-object-two-querystrings.yaml b/tests/schema/fail/operation-object-two-querystrings.yaml new file mode 100644 index 0000000000..35cebf0a3c --- /dev/null +++ b/tests/schema/fail/operation-object-two-querystrings.yaml @@ -0,0 +1,20 @@ +openapi: 3.2.0 +info: + title: API + version: 1.0.0 +components: + pathItems: + my-path-item: + get: + description: querystring cannot be used twice + parameters: + - name: myquerystring1 + in: querystring + content: + application/json: + schema: {} + - name: myquerystring2 + in: querystring + content: + application/json: + schema: {} diff --git a/tests/schema/fail/path-item-object-query-with-querystring.yaml b/tests/schema/fail/path-item-object-query-with-querystring.yaml new file mode 100644 index 0000000000..6efbda4468 --- /dev/null +++ b/tests/schema/fail/path-item-object-query-with-querystring.yaml @@ -0,0 +1,19 @@ +openapi: 3.2.0 +info: + title: API + version: 1.0.0 +components: + pathItems: + my-path-item: + parameters: + - name: myquerystring + in: querystring + content: + application/json: + schema: + type: string + - name: myquery + in: query + schema: + type: string + get: {} diff --git a/tests/schema/fail/path-item-object-two-querystrings.yaml b/tests/schema/fail/path-item-object-two-querystrings.yaml new file mode 100644 index 0000000000..daf5caa494 --- /dev/null +++ b/tests/schema/fail/path-item-object-two-querystrings.yaml @@ -0,0 +1,20 @@ +openapi: 3.2.0 +info: + title: API + version: 1.0.0 +components: + pathItems: + my-path-item: + description: querystring cannot be used twice + parameters: + - name: myquerystring1 + in: querystring + content: + application/json: + schema: {} + - name: myquerystring2 + in: querystring + content: + application/json: + schema: {} + get: {} From 21010ce82e341bb44a7acd6722d50155aa8c66f3 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 12 Sep 2025 16:13:45 -0700 Subject: [PATCH 8/9] allow the use of in: cookie, style: cookie --- src/schemas/validation/schema.yaml | 4 +++- tests/schema/pass/parameter-object-examples.yaml | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/schemas/validation/schema.yaml b/src/schemas/validation/schema.yaml index 4438182897..e8ac6071cd 100644 --- a/src/schemas/validation/schema.yaml +++ b/src/schemas/validation/schema.yaml @@ -485,7 +485,9 @@ $defs: properties: style: default: form - const: form + enum: + - form + - cookie unevaluatedProperties: false diff --git a/tests/schema/pass/parameter-object-examples.yaml b/tests/schema/pass/parameter-object-examples.yaml index f85161f0e3..8a3db655ba 100644 --- a/tests/schema/pass/parameter-object-examples.yaml +++ b/tests/schema/pass/parameter-object-examples.yaml @@ -52,6 +52,14 @@ paths: type: number long: type: number + - in: cookie + name: my_cookie1 + style: form + schema: {} + - in: cookie + name: my_cookie2 + style: cookie + schema: {} /user: parameters: - in: querystring From 2463bd0420c4d273d48a62b30a1609880d762df9 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 12 Sep 2025 17:32:49 -0700 Subject: [PATCH 9/9] style and allowReserved defaults are only in effect when any of style, explode, allowReserved are present see #4899 --- src/schemas/validation/schema.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/schemas/validation/schema.yaml b/src/schemas/validation/schema.yaml index e8ac6071cd..05e5704fe1 100644 --- a/src/schemas/validation/schema.yaml +++ b/src/schemas/validation/schema.yaml @@ -587,7 +587,6 @@ $defs: additionalProperties: $ref: '#/$defs/header-or-reference' style: - default: form enum: - form - spaceDelimited @@ -596,7 +595,6 @@ $defs: explode: type: boolean allowReserved: - default: false type: boolean encoding: type: object @@ -613,6 +611,20 @@ $defs: properties: prefixEncoding: false itemEncoding: false + style: + properties: + allowReserved: + default: false + explode: + properties: + style: + default: form + allowReserved: + default: false + allowReserved: + properties: + style: + default: form allOf: - $ref: '#/$defs/specification-extensions' - $ref: '#/$defs/styles-for-form'