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
The extended example with a multi-document OAD and
a Security Requirement in the referenced document
did to fit well where it was, and there wasn't room in the
Resolving Implicit Connections area. So this moves
it to an Appendix linked from both locations.
Copy file name to clipboardExpand all lines: versions/3.0.4.md
+99-97Lines changed: 99 additions & 97 deletions
Original file line number
Diff line number
Diff line change
@@ -171,7 +171,7 @@ The interface approach can also work for Discriminator Objects and Schema Object
171
171
There are no URI-based alternatives for the Security Requirement Object or for the Operation Object's `tags` field.
172
172
These limitations are expected to be addressed in a future release.
173
173
174
-
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.
174
+
See [Appendix F: Resolving Security Requirements in a Referenced Document](#appendix-f-security-requirement-in-a-referenced-document) for an example of the possible resolutions, including which one is recommended by this section.
175
175
The behavior for Discrimator Object non-URI mappings and for the Operation Object's `tags` field operate on the same principles.
176
176
177
177
Note that no aspect of implicit connection resolution changes how [URLs are resolved](#relative-references-in-urls) or restricts their possible targets.
@@ -3739,6 +3739,8 @@ When a list of Security Requirement Objects is defined on the [OpenAPI Object](#
3739
3739
3740
3740
##### Security Requirement Object Examples
3741
3741
3742
+
See also [Appendix F: Resolving Security Requirements in a Referenced Document](#appendix-f-security-requirement-in-a-referenced-document) for an example using Security Requirement Objects in multi-document OpenAPI Descriptions.
3743
+
3742
3744
###### Non-OAuth2 Security Requirement
3743
3745
3744
3746
```json
@@ -3788,102 +3790,6 @@ security:
3788
3790
- read:pets
3789
3791
```
3790
3792
3791
-
###### Security Requirement in a Referenced Document
3792
-
3793
-
See [Resolving Implicit Connections](#resolving-implicit-connections) for more information.
3794
-
3795
-
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:
3796
-
3797
-
```HTTP
3798
-
GET /api/description/openapi HTTP/1.1
3799
-
Host: www.example.com
3800
-
Accept: application/openapi+json
3801
-
```
3802
-
3803
-
```json
3804
-
"components": {
3805
-
"securitySchemes": {
3806
-
"MySecurity": {
3807
-
"type": "http",
3808
-
"scheme": "bearer",
3809
-
"bearerFormat": "JWT"
3810
-
}
3811
-
}
3812
-
},
3813
-
"paths": {
3814
-
"/foo": {
3815
-
"$ref": "other#/components/pathItems/Foo"
3816
-
}
3817
-
}
3818
-
```
3819
-
3820
-
```HTTP
3821
-
GET /api/description/openapi HTTP/1.1
3822
-
Host: www.example.com
3823
-
Accept: application/openapi+yaml
3824
-
```
3825
-
3826
-
```yaml
3827
-
components:
3828
-
securitySchemes:
3829
-
MySecurity:
3830
-
type: http
3831
-
scheme: bearer
3832
-
bearerFormat: JWT
3833
-
paths:
3834
-
/foo:
3835
-
$ref: 'other#/components/pathItems/Foo'
3836
-
```
3837
-
3838
-
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:
3839
-
3840
-
```HTTP
3841
-
GET /api/description/other HTTP/1.1
3842
-
Host: www.example.com
3843
-
Accept: application/openapi+json
3844
-
```
3845
-
3846
-
```json
3847
-
"components": {
3848
-
"securitySchemes": {
3849
-
"MySecurity": {
3850
-
"type": "http",
3851
-
"scheme": "basic"
3852
-
}
3853
-
},
3854
-
"pathItems": {
3855
-
"Foo": {
3856
-
"get": {
3857
-
"security": [
3858
-
"MySecurity": []
3859
-
]
3860
-
}
3861
-
}
3862
-
}
3863
-
}
3864
-
```
3865
-
3866
-
```HTTP
3867
-
GET /api/description/other HTTP/1.1
3868
-
Host: www.example.com
3869
-
Accept: application/openapi+yaml
3870
-
```
3871
-
3872
-
```yaml
3873
-
components:
3874
-
securitySchemes:
3875
-
MySecurity:
3876
-
type: http
3877
-
scheme: basic
3878
-
pathItems:
3879
-
Foo:
3880
-
get:
3881
-
security:
3882
-
- MySecurity: []
3883
-
```
3884
-
3885
-
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.
3886
-
3887
3793
### Specification Extensions
3888
3794
3889
3795
While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.
@@ -4347,3 +4253,99 @@ Code that relies on leaving these delimiters unencoded, while using regular perc
4347
4253
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.
4348
4254
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.
4349
4255
This keeps it outside of the processes governed by this specification.
4256
+
4257
+
## Appendix F: Resolving Security Requirements in a Referenced Document
4258
+
4259
+
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.
4260
+
4261
+
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:
4262
+
4263
+
```HTTP
4264
+
GET /api/description/openapi HTTP/1.1
4265
+
Host: www.example.com
4266
+
Accept: application/openapi+json
4267
+
```
4268
+
4269
+
```json
4270
+
"components": {
4271
+
"securitySchemes": {
4272
+
"MySecurity": {
4273
+
"type": "http",
4274
+
"scheme": "bearer",
4275
+
"bearerFormat": "JWT"
4276
+
}
4277
+
}
4278
+
},
4279
+
"paths": {
4280
+
"/foo": {
4281
+
"$ref": "other#/components/pathItems/Foo"
4282
+
}
4283
+
}
4284
+
```
4285
+
4286
+
```HTTP
4287
+
GET /api/description/openapi HTTP/1.1
4288
+
Host: www.example.com
4289
+
Accept: application/openapi+yaml
4290
+
```
4291
+
4292
+
```yaml
4293
+
components:
4294
+
securitySchemes:
4295
+
MySecurity:
4296
+
type: http
4297
+
scheme: bearer
4298
+
bearerFormat: JWT
4299
+
paths:
4300
+
/foo:
4301
+
$ref: 'other#/components/pathItems/Foo'
4302
+
```
4303
+
4304
+
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:
4305
+
4306
+
```HTTP
4307
+
GET /api/description/other HTTP/1.1
4308
+
Host: www.example.com
4309
+
Accept: application/openapi+json
4310
+
```
4311
+
4312
+
```json
4313
+
"components": {
4314
+
"securitySchemes": {
4315
+
"MySecurity": {
4316
+
"type": "http",
4317
+
"scheme": "basic"
4318
+
}
4319
+
},
4320
+
"pathItems": {
4321
+
"Foo": {
4322
+
"get": {
4323
+
"security": [
4324
+
"MySecurity": []
4325
+
]
4326
+
}
4327
+
}
4328
+
}
4329
+
}
4330
+
```
4331
+
4332
+
```HTTP
4333
+
GET /api/description/other HTTP/1.1
4334
+
Host: www.example.com
4335
+
Accept: application/openapi+yaml
4336
+
```
4337
+
4338
+
```yaml
4339
+
components:
4340
+
securitySchemes:
4341
+
MySecurity:
4342
+
type: http
4343
+
scheme: basic
4344
+
pathItems:
4345
+
Foo:
4346
+
get:
4347
+
security:
4348
+
- MySecurity: []
4349
+
```
4350
+
4351
+
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