Skip to content

Commit 4a1b2e2

Browse files
committed
feat(schema): update empty security array constraint
based on discussions * OAI#3938 (comment) * OAI#4007
1 parent 0056446 commit 4a1b2e2

File tree

1 file changed

+74
-44
lines changed

1 file changed

+74
-44
lines changed

schemas/v3.0/schema.yaml

Lines changed: 74 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
id: https://spec.openapis.org/oas/3.0/schema/2019-04-02
1+
id: https://spec.openapis.org/oas/3.0/schema/2021-09-28
22
$schema: http://json-schema.org/draft-04/schema#
3-
description: Validation schema for OpenAPI Specification 3.0.X.
3+
description: The description of OpenAPI v3.0.x documents, as defined by https://spec.openapis.org/oas/v3.0.3
44
type: object
55
required:
66
- openapi
@@ -20,6 +20,7 @@ properties:
2020
$ref: '#/definitions/Server'
2121
security:
2222
type: array
23+
minItems: 1
2324
items:
2425
$ref: '#/definitions/SecurityRequirement'
2526
tags:
@@ -495,6 +496,22 @@ definitions:
495496
type: string
496497
description:
497498
type: string
499+
get:
500+
$ref: '#/definitions/Operation'
501+
put:
502+
$ref: '#/definitions/Operation'
503+
post:
504+
$ref: '#/definitions/Operation'
505+
delete:
506+
$ref: '#/definitions/Operation'
507+
options:
508+
$ref: '#/definitions/Operation'
509+
head:
510+
$ref: '#/definitions/Operation'
511+
patch:
512+
$ref: '#/definitions/Operation'
513+
trace:
514+
$ref: '#/definitions/Operation'
498515
servers:
499516
type: array
500517
items:
@@ -507,8 +524,6 @@ definitions:
507524
- $ref: '#/definitions/Reference'
508525
uniqueItems: true
509526
patternProperties:
510-
'^(get|put|post|delete|options|head|patch|trace)$':
511-
$ref: '#/definitions/Operation'
512527
'^x-': {}
513528
additionalProperties: false
514529

@@ -553,6 +568,7 @@ definitions:
553568
default: false
554569
security:
555570
type: array
571+
minItems: 1
556572
items:
557573
$ref: '#/definitions/SecurityRequirement'
558574
servers:
@@ -692,46 +708,51 @@ definitions:
692708
allOf:
693709
- $ref: '#/definitions/ExampleXORExamples'
694710
- $ref: '#/definitions/SchemaXORContent'
695-
- $ref: '#/definitions/ParameterLocation'
696-
697-
ParameterLocation:
698-
description: Parameter location
699711
oneOf:
700-
- description: Parameter in path
701-
required:
702-
- required
703-
properties:
704-
in:
705-
enum: [path]
706-
style:
707-
enum: [matrix, label, simple]
708-
default: simple
709-
required:
710-
enum: [true]
711-
712-
- description: Parameter in query
713-
properties:
714-
in:
715-
enum: [query]
716-
style:
717-
enum: [form, spaceDelimited, pipeDelimited, deepObject]
718-
default: form
712+
- $ref: '#/definitions/PathParameter'
713+
- $ref: '#/definitions/QueryParameter'
714+
- $ref: '#/definitions/HeaderParameter'
715+
- $ref: '#/definitions/CookieParameter'
719716

720-
- description: Parameter in header
721-
properties:
722-
in:
723-
enum: [header]
724-
style:
725-
enum: [simple]
726-
default: simple
717+
PathParameter:
718+
description: Parameter in path
719+
required:
720+
- required
721+
properties:
722+
in:
723+
enum: [path]
724+
style:
725+
enum: [matrix, label, simple]
726+
default: simple
727+
required:
728+
enum: [true]
727729

728-
- description: Parameter in cookie
729-
properties:
730-
in:
731-
enum: [cookie]
732-
style:
733-
enum: [form]
734-
default: form
730+
QueryParameter:
731+
description: Parameter in query
732+
properties:
733+
in:
734+
enum: [query]
735+
style:
736+
enum: [form, spaceDelimited, pipeDelimited, deepObject]
737+
default: form
738+
739+
HeaderParameter:
740+
description: Parameter in header
741+
properties:
742+
in:
743+
enum: [header]
744+
style:
745+
enum: [simple]
746+
default: simple
747+
748+
CookieParameter:
749+
description: Parameter in cookie
750+
properties:
751+
in:
752+
enum: [cookie]
753+
style:
754+
enum: [form]
755+
default: form
735756

736757
RequestBody:
737758
type: object
@@ -806,15 +827,17 @@ definitions:
806827
- description: Bearer
807828
properties:
808829
scheme:
809-
enum: [bearer]
830+
type: string
831+
pattern: ^[Bb][Ee][Aa][Rr][Ee][Rr]$
810832

811833
- description: Non Bearer
812834
not:
813835
required: [bearerFormat]
814836
properties:
815837
scheme:
816838
not:
817-
enum: [bearer]
839+
type: string
840+
pattern: ^[Bb][Ee][Aa][Rr][Ee][Rr]$
818841

819842
OAuth2SecurityScheme:
820843
type: object
@@ -892,6 +915,7 @@ definitions:
892915
type: object
893916
required:
894917
- tokenUrl
918+
- scopes
895919
properties:
896920
tokenUrl:
897921
type: string
@@ -911,6 +935,7 @@ definitions:
911935
type: object
912936
required:
913937
- tokenUrl
938+
- scopes
914939
properties:
915940
tokenUrl:
916941
type: string
@@ -931,6 +956,7 @@ definitions:
931956
required:
932957
- authorizationUrl
933958
- tokenUrl
959+
- scopes
934960
properties:
935961
authorizationUrl:
936962
type: string
@@ -987,7 +1013,9 @@ definitions:
9871013
headers:
9881014
type: object
9891015
additionalProperties:
990-
$ref: '#/definitions/Header'
1016+
oneOf:
1017+
- $ref: '#/definitions/Header'
1018+
- $ref: '#/definitions/Reference'
9911019
style:
9921020
type: string
9931021
enum:
@@ -1000,4 +1028,6 @@ definitions:
10001028
allowReserved:
10011029
type: boolean
10021030
default: false
1031+
patternProperties:
1032+
'^x-': {}
10031033
additionalProperties: false

0 commit comments

Comments
 (0)