Skip to content

Commit 59148a2

Browse files
committed
Add example resolution of Security Requirement
1 parent b42fa95 commit 59148a2

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

versions/3.1.1.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ The interface approach can also work for Discriminator Objects and Schema Object
225225
There are no URI-based alternatives for the Security Requirement Object or for the Operation Object's `tags` field.
226226
These limitations are expected to be addressed in a future release.
227227

228+
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.
229+
The behavior for Discrimator Object non-URI mappings and for the Operation Object's `tags` field operate on the same principles.
230+
228231
Note that no aspect of implicit connection resolution changes how [URIs are resolved](#relativeReferencesURI), or restricts their possible targets.
229232

230233
### <a name="dataTypes"></a>Data Types
@@ -3826,6 +3829,41 @@ security:
38263829
- read:pets
38273830
```
38283831

3832+
###### Security Requirement in a Referenced Document
3833+
3834+
See [Resolving Implicit Connections](#resolvingImplicitConnections) for more information.
3835+
3836+
Entry document `openapi.yaml`:
3837+
3838+
```YAML
3839+
components:
3840+
securitySchemes:
3841+
MySecurity:
3842+
type: http
3843+
scheme: bearer
3844+
bearerFormat: JWT
3845+
paths:
3846+
/foo:
3847+
$ref: "other.yaml#/components/pathItems/Foo"
3848+
```
3849+
3850+
Referenced document `other.yaml`:
3851+
3852+
```YAML
3853+
components:
3854+
securitySchemes:
3855+
MySecurity:
3856+
type: http
3857+
scheme: basic
3858+
pathItems:
3859+
Foo:
3860+
get:
3861+
security:
3862+
- MySecurity: []
3863+
```
3864+
3865+
In this example, it is implementation-defined whether the Security Requirement for "MySecurity" in `other.yaml` resolves to `other.yaml#/components/securitySchemes/MySecurity` or the RECOMMENDED resolved ___location of `openapi.yaml#/components/securitySchemes/MySecurity`.
3866+
38293867
### <a name="specificationExtensions"></a>Specification Extensions
38303868

38313869
While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

0 commit comments

Comments
 (0)