You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versions/3.1.1.md
+99-97
Original file line number
Diff line number
Diff line change
@@ -198,7 +198,7 @@ The interface approach can also work for Discriminator Objects and Schema Object
198
198
There are no URI-based alternatives for the Security Requirement Object or for the Operation Object's `tags` field.
199
199
These limitations are expected to be addressed in a future release.
200
200
201
-
See [Security Requirement in a Referenced Document](#security-requirement-in-a-referenced-document) for an example of the possible resolutions, including which one is recommended by this section.
201
+
See [Appendix F: Resolving Security Requirements in a Referenced Document](#appendix-f-resolving-security-requirements-in-a-referenced-document) for an example of the possible resolutions, including which one is recommended by this section.
202
202
The behavior for Discrimator Object non-URI mappings and for the Operation Object's `tags` field operate on the same principles.
203
203
204
204
Note that no aspect of implicit connection resolution changes how [URIs are resolved](#relative-references-in-api-description-uris), or restricts their possible targets.
@@ -3939,6 +3939,8 @@ When a list of Security Requirement Objects is defined on the [OpenAPI Object](#
3939
3939
3940
3940
##### Security Requirement Object Examples
3941
3941
3942
+
See also [Appendix F: Resolving Security Requirements in a Referenced Document](#appendix-f-resolving-security-requirements-in-a-referenced-document) for an example using Security Requirement Objects in multi-document OpenAPI Descriptions.
3943
+
3942
3944
###### Non-OAuth2 Security Requirement
3943
3945
3944
3946
```json
@@ -3988,102 +3990,6 @@ security:
3988
3990
- read:pets
3989
3991
```
3990
3992
3991
-
###### Security Requirement in a Referenced Document
3992
-
3993
-
See [Resolving Implicit Connections](#resolving-implicit-connections) for more information.
3994
-
3995
-
First, the [entry document](#openapi-description-structure) is where parsing begins. It defines the `MySecurity` security scheme to be JWT-based, and it defines a Path Item as a reference to a component in another document:
3996
-
3997
-
```HTTP
3998
-
GET /api/description/openapi HTTP/1.1
3999
-
Host: www.example.com
4000
-
Accept: application/openapi+json
4001
-
```
4002
-
4003
-
```json
4004
-
"components": {
4005
-
"securitySchemes": {
4006
-
"MySecurity": {
4007
-
"type": "http",
4008
-
"scheme": "bearer",
4009
-
"bearerFormat": "JWT"
4010
-
}
4011
-
}
4012
-
},
4013
-
"paths": {
4014
-
"/foo": {
4015
-
"$ref": "other#/components/pathItems/Foo"
4016
-
}
4017
-
}
4018
-
```
4019
-
4020
-
```HTTP
4021
-
GET /api/description/openapi HTTP/1.1
4022
-
Host: www.example.com
4023
-
Accept: application/openapi+yaml
4024
-
```
4025
-
4026
-
```yaml
4027
-
components:
4028
-
securitySchemes:
4029
-
MySecurity:
4030
-
type: http
4031
-
scheme: bearer
4032
-
bearerFormat: JWT
4033
-
paths:
4034
-
/foo:
4035
-
$ref: 'other#/components/pathItems/Foo'
4036
-
```
4037
-
4038
-
This entry document references another document, `other`, without using a file extension. This gives the client the flexibility to choose an acceptable format on a resource-by-resource basis, assuming both representations are available:
4039
-
4040
-
```HTTP
4041
-
GET /api/description/other HTTP/1.1
4042
-
Host: www.example.com
4043
-
Accept: application/openapi+json
4044
-
```
4045
-
4046
-
```json
4047
-
"components": {
4048
-
"securitySchemes": {
4049
-
"MySecurity": {
4050
-
"type": "http",
4051
-
"scheme": "basic"
4052
-
}
4053
-
},
4054
-
"pathItems": {
4055
-
"Foo": {
4056
-
"get": {
4057
-
"security": [
4058
-
"MySecurity": []
4059
-
]
4060
-
}
4061
-
}
4062
-
}
4063
-
}
4064
-
```
4065
-
4066
-
```HTTP
4067
-
GET /api/description/other HTTP/1.1
4068
-
Host: www.example.com
4069
-
Accept: application/openapi+yaml
4070
-
```
4071
-
4072
-
```yaml
4073
-
components:
4074
-
securitySchemes:
4075
-
MySecurity:
4076
-
type: http
4077
-
scheme: basic
4078
-
pathItems:
4079
-
Foo:
4080
-
get:
4081
-
security:
4082
-
- MySecurity: []
4083
-
```
4084
-
4085
-
In the `other` document, the referenced path item has a Security Requirement for a Security Scheme, `MySecurity`. The same Security Scheme exists in the original entry document. As outlined in [Resolving Implicit Connections](#resolving-implicit-connections), `MySecurity` is resolved with an [implementation-defined behavior](#undefined-and-implementation-defined-behavior). However, documented in that section, it is RECOMMENDED that tools resolve component names from the [entry document](#openapi-description-structure). As with all implementation-defined behavior, it is important to check tool documentation to determine which behavior is supported.
4086
-
4087
3993
### Specification Extensions
4088
3994
4089
3995
While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.
@@ -4556,3 +4462,99 @@ Code that relies on leaving these delimiters unencoded, while using regular perc
4556
4462
For maximum interoperability, it is RECOMMENDED to either define and document an additional escape convention while percent-encoding the delimiters for these styles, or to avoid these styles entirely.
4557
4463
The exact method of additional encoding/escaping is left to the API designer, and is expected to be performed before serialization and encoding described in this specification, and reversed after this specification's encoding and serialization steps are reversed.
4558
4464
This keeps it outside of the processes governed by this specification.
4465
+
4466
+
## Appendix F: Resolving Security Requirements in a Referenced Document
4467
+
4468
+
This appendix shows how to retrieve an HTTP-accessible multi-document OpenAPI Description (OAD) and resolve a [Security Requirement Object](#security-requirement-object) in the referenced (non-entry) document. See [Resolving Implicit Connections](#resolving-implicit-connections) for more information.
4469
+
4470
+
First, the [entry document](#openapi-description-structure) is where parsing begins. It defines the `MySecurity` security scheme to be JWT-based, and it defines a Path Item as a reference to a component in another document:
4471
+
4472
+
```HTTP
4473
+
GET /api/description/openapi HTTP/1.1
4474
+
Host: www.example.com
4475
+
Accept: application/openapi+json
4476
+
```
4477
+
4478
+
```json
4479
+
"components": {
4480
+
"securitySchemes": {
4481
+
"MySecurity": {
4482
+
"type": "http",
4483
+
"scheme": "bearer",
4484
+
"bearerFormat": "JWT"
4485
+
}
4486
+
}
4487
+
},
4488
+
"paths": {
4489
+
"/foo": {
4490
+
"$ref": "other#/components/pathItems/Foo"
4491
+
}
4492
+
}
4493
+
```
4494
+
4495
+
```HTTP
4496
+
GET /api/description/openapi HTTP/1.1
4497
+
Host: www.example.com
4498
+
Accept: application/openapi+yaml
4499
+
```
4500
+
4501
+
```yaml
4502
+
components:
4503
+
securitySchemes:
4504
+
MySecurity:
4505
+
type: http
4506
+
scheme: bearer
4507
+
bearerFormat: JWT
4508
+
paths:
4509
+
/foo:
4510
+
$ref: 'other#/components/pathItems/Foo'
4511
+
```
4512
+
4513
+
This entry document references another document, `other`, without using a file extension. This gives the client the flexibility to choose an acceptable format on a resource-by-resource basis, assuming both representations are available:
4514
+
4515
+
```HTTP
4516
+
GET /api/description/other HTTP/1.1
4517
+
Host: www.example.com
4518
+
Accept: application/openapi+json
4519
+
```
4520
+
4521
+
```json
4522
+
"components": {
4523
+
"securitySchemes": {
4524
+
"MySecurity": {
4525
+
"type": "http",
4526
+
"scheme": "basic"
4527
+
}
4528
+
},
4529
+
"pathItems": {
4530
+
"Foo": {
4531
+
"get": {
4532
+
"security": [
4533
+
"MySecurity": []
4534
+
]
4535
+
}
4536
+
}
4537
+
}
4538
+
}
4539
+
```
4540
+
4541
+
```HTTP
4542
+
GET /api/description/other HTTP/1.1
4543
+
Host: www.example.com
4544
+
Accept: application/openapi+yaml
4545
+
```
4546
+
4547
+
```yaml
4548
+
components:
4549
+
securitySchemes:
4550
+
MySecurity:
4551
+
type: http
4552
+
scheme: basic
4553
+
pathItems:
4554
+
Foo:
4555
+
get:
4556
+
security:
4557
+
- MySecurity: []
4558
+
```
4559
+
4560
+
In the `other` document, the referenced path item has a Security Requirement for a Security Scheme, `MySecurity`. The same Security Scheme exists in the original entry document. As outlined in [Resolving Implicit Connections](#resolving-implicit-connections), `MySecurity` is resolved with an [implementation-defined behavior](#undefined-and-implementation-defined-behavior). However, documented in that section, it is RECOMMENDED that tools resolve component names from the [entry document](#openapi-description-structure). As with all implementation-defined behavior, it is important to check tool documentation to determine which behavior is supported.
0 commit comments