Skip to content

Commit 713bbbb

Browse files
committed
Schema changes
1 parent a83ae2a commit 713bbbb

1 file changed

Lines changed: 83 additions & 30 deletions

File tree

src/schemas/validation/schema.yaml

Lines changed: 83 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -405,24 +405,72 @@ $defs:
405405
type: string
406406
explode:
407407
type: boolean
408-
allowReserved:
409-
default: false
410-
type: boolean
408+
if:
409+
$ref: '#/$defs/parameter/dependentSchemas/schema/$defs/percent-encoding-applies-to-style'
410+
then:
411+
properties:
412+
allowReserved:
413+
default: false
414+
type: boolean
411415
allOf:
416+
- $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/explode-defaults'
412417
- $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path'
413418
- $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header'
414419
- $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query'
415420
- $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie'
416-
- $ref: '#/$defs/styles-for-form'
417421

418422
$defs:
423+
percent-encoding-applies-to-style:
424+
$comment: |
425+
This is always for `in: "query"` or `in: "path"`,
426+
but for `in: "cookie"`, it is only for `style: "form"`.
427+
Note that `in` is already always required.
428+
oneOf:
429+
- properties:
430+
in:
431+
enum:
432+
- path
433+
- query
434+
- $comment: |
435+
Note that `style` is not required, but if it is present,
436+
it must be `"form"`, which is the default when it is absent.
437+
properties:
438+
in:
439+
const: form
440+
style:
441+
const: form
442+
explode-defaults:
443+
$comment: |
444+
For these `in` values, `style` can either be absent,
445+
in which case it defaults to "form", or it can
446+
be explicitly set to "form" or "cookie". In all other
447+
cases, `explode` defaults to `false`.
448+
Note that `in: "query", style: "cookie"` is prevented
449+
by other parts of the schema.
450+
if:
451+
properties:
452+
in:
453+
enum:
454+
- query
455+
- cookie
456+
style:
457+
enum:
458+
- form
459+
- cookie
460+
then:
461+
properties:
462+
explode:
463+
default: true
464+
else:
465+
properties:
466+
explode:
467+
default: false
468+
419469
styles-for-path:
420470
if:
421471
properties:
422472
in:
423473
const: path
424-
required:
425-
- in
426474
then:
427475
properties:
428476
style:
@@ -441,8 +489,6 @@ $defs:
441489
properties:
442490
in:
443491
const: header
444-
required:
445-
- in
446492
then:
447493
properties:
448494
style:
@@ -454,8 +500,6 @@ $defs:
454500
properties:
455501
in:
456502
const: query
457-
required:
458-
- in
459503
then:
460504
properties:
461505
style:
@@ -471,13 +515,13 @@ $defs:
471515
properties:
472516
in:
473517
const: cookie
474-
required:
475-
- in
476518
then:
477519
properties:
478520
style:
479521
default: form
480-
const: form
522+
enum:
523+
- form
524+
- cookie
481525

482526
unevaluatedProperties: false
483527

@@ -598,9 +642,34 @@ $defs:
598642
$ref: '#/$defs/encoding'
599643
itemEncoding:
600644
$ref: '#/$defs/encoding'
645+
if:
646+
anyOf:
647+
- properties:
648+
style:
649+
const: form
650+
required:
651+
- style
652+
- $comment: |
653+
`style` defaults to "form" if either
654+
`explode` or `allowReserved` are present.
655+
not:
656+
required:
657+
- style
658+
anyOf:
659+
- required:
660+
- explode
661+
- required:
662+
- allowReserved
663+
then:
664+
properties:
665+
explode:
666+
default: true
667+
else:
668+
properties:
669+
explode:
670+
default: false
601671
allOf:
602672
- $ref: '#/$defs/specification-extensions'
603-
- $ref: '#/$defs/styles-for-form'
604673
- dependentSchemas:
605674
encoding:
606675
properties:
@@ -1100,19 +1169,3 @@ $defs:
11001169
type: object
11011170
additionalProperties:
11021171
type: string
1103-
1104-
styles-for-form:
1105-
if:
1106-
properties:
1107-
style:
1108-
const: form
1109-
required:
1110-
- style
1111-
then:
1112-
properties:
1113-
explode:
1114-
default: true
1115-
else:
1116-
properties:
1117-
explode:
1118-
default: false

0 commit comments

Comments
 (0)