Skip to content

Commit 1e12511

Browse files
allowReserved only permitted in encoding objects, and parameter objects with in:query
(this was changed in 3.2.0 to allow it wherever percent-encoding is done)
1 parent 14d3b2c commit 1e12511

8 files changed

Lines changed: 80 additions & 4 deletions

src/schemas/validation/schema.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ $defs:
421421
style:
422422
default: form
423423
const: form
424+
$ref: '#/$defs/explode-for-form'
424425

425426
$ref: '#/$defs/specification-extensions'
426427
unevaluatedProperties: false
@@ -510,6 +511,7 @@ $defs:
510511
properties:
511512
allowReserved:
512513
default: false
514+
$ref: '#/$defs/styles-for-form'
513515
explode:
514516
properties:
515517
style:
@@ -520,9 +522,8 @@ $defs:
520522
properties:
521523
style:
522524
default: form
523-
allOf:
524-
- $ref: '#/$defs/specification-extensions'
525-
- $ref: '#/$defs/styles-for-form'
525+
$ref: '#/$defs/styles-for-form'
526+
$ref: '#/$defs/specification-extensions'
526527
unevaluatedProperties: false
527528

528529
responses:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
openapi: 3.1.0
2+
info:
3+
title: "allowReserved only permitted with in: query"
4+
version: 1.0.0
5+
components:
6+
headers:
7+
Style:
8+
schema:
9+
type: array
10+
style: simple
11+
explode: true
12+
allowReserved: true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
openapi: 3.1.0
2+
info:
3+
title: allowReserved only permitted with in and style values that percent-encode
4+
version: 1.0.0
5+
components:
6+
parameters:
7+
style_form:
8+
name: my_form_cookie
9+
in: cookie
10+
# default style is form, therefore allowReserved is allowed
11+
allowReserved: true
12+
schema: {}
13+
style_cookie:
14+
name: my_cookie_cookie
15+
in: cookie
16+
style: cookie
17+
# no percent decoding for style=cookie, therefore allowReserved is not allowed
18+
schema: {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
openapi: 3.1.0
2+
info:
3+
title: allowReserved only permitted with in and style values that percent-encode
4+
version: 1.0.0
5+
components:
6+
parameters:
7+
header:
8+
name: my-header
9+
in: header
10+
allowReserved: false
11+
schema: {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
openapi: 3.1.0
2+
info:
3+
title: "allowReserved only permitted with in: query"
4+
version: 1.0.0
5+
components:
6+
parameters:
7+
path:
8+
name: my-path
9+
in: path
10+
allowReserved: false
11+
schema: {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
openapi: 3.1.0
2+
info:
3+
title: api
4+
version: 1.0.0
5+
components:
6+
parameters:
7+
path:
8+
name: my-path
9+
in: path
10+
required: true
11+
allowReserved: false
12+
schema: {}

tests/schema/pass/header-object-examples.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ components:
2222
schema:
2323
type: array
2424
style: simple
25-
explode: true
25+
explode: true
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
openapi: 3.1.0
2+
info:
3+
title: "allowReserved only permitted with in: query"
4+
version: 1.0.0
5+
components:
6+
parameters:
7+
my_query:
8+
name: my_query
9+
in: query
10+
allowReserved: true
11+
schema: {}

0 commit comments

Comments
 (0)