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.2.0.md
+99Lines changed: 99 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -239,6 +239,9 @@ The interface approach can also work for Discriminator Objects and Schema Object
239
239
There are no URI-based alternatives for the Security Requirement Object or for the Operation Object's `tags` field.
240
240
These limitations are expected to be addressed in a future release.
241
241
242
+
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.
243
+
The behavior for Discrimator Object non-URI mappings and for the Operation Object's `tags` field operate on the same principles.
244
+
242
245
Note that no aspect of implicit connection resolution changes how [URIs are resolved](#relativeReferencesURI), or restricts their possible targets.
243
246
244
247
### <aname="dataTypes"></a>Data Types
@@ -4035,6 +4038,102 @@ security:
4035
4038
- read:pets
4036
4039
```
4037
4040
4041
+
###### Security Requirement in a Referenced Document
4042
+
4043
+
See [Resolving Implicit Connections](#resolvingImplicitConnections) for more information.
4044
+
4045
+
First, our entry document is where parsing begins. It defines the `MySecurity` security scheme to be JWT-based, and it defines on Path Item as a reference to a component in another document:
4046
+
4047
+
```HTTP
4048
+
GET /api/description/openapi HTTP/1.1
4049
+
Host: www.example.com
4050
+
Accept: application/openapi+json
4051
+
```
4052
+
4053
+
```json
4054
+
"components": {
4055
+
"securitySchemes": {
4056
+
"MySecurity": {
4057
+
"type": "http",
4058
+
"scheme": "bearer",
4059
+
"bearerFormat": "JWT"
4060
+
}
4061
+
}
4062
+
},
4063
+
"paths": {
4064
+
"/foo": {
4065
+
"$ref": "other#/components/pathItems/Foo"
4066
+
}
4067
+
}
4068
+
```
4069
+
4070
+
```HTTP
4071
+
GET /api/description/openapi HTTP/1.1
4072
+
Host: www.example.com
4073
+
Accept: application/openapi+yaml
4074
+
```
4075
+
4076
+
```yaml
4077
+
components:
4078
+
securitySchemes:
4079
+
MySecurity:
4080
+
type: http
4081
+
scheme: bearer
4082
+
bearerFormat: JWT
4083
+
paths:
4084
+
/foo:
4085
+
$ref: "other#/components/pathItems/Foo"
4086
+
```
4087
+
4088
+
Next, we have our referenced document, `other`, that we presumably request in the same format we requested for the entry document. But the fact that we don't use file extensions gives the client the flexibilty to choose on a resource-by-resource basis, assuming both representations are available:
4089
+
4090
+
```HTTP
4091
+
GET /api/description/other HTTP/1.1
4092
+
Host: www.example.com
4093
+
Accept: application/openapi+json
4094
+
```
4095
+
4096
+
```json
4097
+
"components": {
4098
+
"securitySchemes": {
4099
+
"MySecurity": {
4100
+
"type": "http",
4101
+
"scheme": "basic"
4102
+
}
4103
+
},
4104
+
"pathItems": {
4105
+
"Foo": {
4106
+
"get": {
4107
+
"security": [
4108
+
"MySecurity": []
4109
+
]
4110
+
}
4111
+
}
4112
+
}
4113
+
}
4114
+
```
4115
+
4116
+
```HTTP
4117
+
GET /api/description/other HTTP/1.1
4118
+
Host: www.example.com
4119
+
Accept: application/openapi+yaml
4120
+
```
4121
+
4122
+
```yaml
4123
+
components:
4124
+
securitySchemes:
4125
+
MySecurity:
4126
+
type: http
4127
+
scheme: basic
4128
+
pathItems:
4129
+
Foo:
4130
+
get:
4131
+
security:
4132
+
- MySecurity: []
4133
+
```
4134
+
4135
+
In this `other` document, the reference path item has a Security Requirement for the Security Scheme "MySecurity". But there is a Security Scheme by that name in the `other` document as well. As discussed in [Resolving Implicit Connections](#resolvingImplicitConnections), which "MySecurity" gets used is [implementation-defined](#undefinedAndImplementationDefinedBehavior). However, as also documented in that section, it is RECOMMENDED that tools resolve component names from the [entry document](#documentStructure). As with all implementation-defined behavior, it is important to check tool documentation to determine which behavior is supported.
0 commit comments