Skip to content

Commit 1dc386e

Browse files
authored
chore: merge pull request #1339 from awslabs/release/v1.19.1
chore: merge Release/v1.19.1 into master
2 parents 93b6ac0 + da1ecea commit 1dc386e

19 files changed

+467
-428
lines changed

samtranslator/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.19.0'
1+
__version__ = '1.19.1'

samtranslator/open_api/open_api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self, doc):
3535

3636
self._doc = copy.deepcopy(doc)
3737
self.paths = self._doc["paths"]
38-
self.security_schemes = self._doc.get("securitySchemes", {})
38+
self.security_schemes = self._doc.get("components", {}).get("securitySchemes", {})
3939
self.definitions = self._doc.get('definitions', {})
4040

4141
def get_path(self, path):
@@ -346,7 +346,8 @@ def openapi(self):
346346
self._doc["paths"] = self.paths
347347

348348
if self.security_schemes:
349-
self._doc["securitySchemes"] = self.security_schemes
349+
self._doc.setdefault("components", {})
350+
self._doc["components"]["securitySchemes"] = self.security_schemes
350351

351352
return copy.deepcopy(self._doc)
352353

tests/translator/input/http_api_existing_openapi.yaml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,24 @@ Resources:
7272
- scope4
7373
responses: {}
7474
openapi: 3.0.1
75-
securitySchemes:
76-
oauth2Auth:
77-
type: oauth2
78-
x-amazon-apigateway-authorizer:
79-
identitySource: "$request.querystring.param"
80-
type: jwt
81-
jwtConfiguration:
82-
audience:
83-
- MyApi
84-
issuer: https://www.example.com/v1/connect/oidc
85-
OpenIdAuth:
86-
type: openIdConnect
87-
x-amazon-apigateway-authorizer:
88-
identitySource: "$request.querystring.param"
89-
type: jwt
90-
jwtConfiguration:
91-
audience:
92-
- MyApi
93-
issuer: https://www.example.com/v1/connect/oidc
94-
openIdConnectUrl: https://www.example.com/v1/connect
75+
components:
76+
securitySchemes:
77+
oauth2Auth:
78+
type: oauth2
79+
x-amazon-apigateway-authorizer:
80+
identitySource: "$request.querystring.param"
81+
type: jwt
82+
jwtConfiguration:
83+
audience:
84+
- MyApi
85+
issuer: https://www.example.com/v1/connect/oidc
86+
OpenIdAuth:
87+
type: openIdConnect
88+
x-amazon-apigateway-authorizer:
89+
identitySource: "$request.querystring.param"
90+
type: jwt
91+
jwtConfiguration:
92+
audience:
93+
- MyApi
94+
issuer: https://www.example.com/v1/connect/oidc
95+
openIdConnectUrl: https://www.example.com/v1/connect

tests/translator/input/http_api_existing_openapi_conditions.yaml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,24 @@ Resources:
106106
- scope4
107107
responses: {}
108108
openapi: 3.0.1
109-
securitySchemes:
110-
oauth2Auth:
111-
type: oauth2
112-
x-amazon-apigateway-authorizer:
113-
identitySource: "$request.querystring.param"
114-
type: jwt
115-
jwtConfiguration:
116-
audience:
117-
- MyApi
118-
issuer: https://www.example.com/v1/connect/oidc
119-
OpenIdAuth:
120-
type: openIdConnect
121-
x-amazon-apigateway-authorizer:
122-
identitySource: "$request.querystring.param"
123-
type: jwt
124-
jwtConfiguration:
125-
audience:
126-
- MyApi
127-
issuer: https://www.example.com/v1/connect/oidc
128-
openIdConnectUrl: https://www.example.com/v1/connect
109+
components:
110+
securitySchemes:
111+
oauth2Auth:
112+
type: oauth2
113+
x-amazon-apigateway-authorizer:
114+
identitySource: "$request.querystring.param"
115+
type: jwt
116+
jwtConfiguration:
117+
audience:
118+
- MyApi
119+
issuer: https://www.example.com/v1/connect/oidc
120+
OpenIdAuth:
121+
type: openIdConnect
122+
x-amazon-apigateway-authorizer:
123+
identitySource: "$request.querystring.param"
124+
type: jwt
125+
jwtConfiguration:
126+
audience:
127+
- MyApi
128+
issuer: https://www.example.com/v1/connect/oidc
129+
openIdConnectUrl: https://www.example.com/v1/connect

tests/translator/output/aws-cn/explicit_http_api.json

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,24 @@
9595
}
9696
}
9797
},
98-
"openapi": "3.0.1",
99-
"securitySchemes": {
100-
"OAuth2": {
101-
"type": "oauth2",
102-
"x-amazon-apigateway-authorizer": {
103-
"identitySource": "$request.querystring.param",
104-
"type": "jwt",
105-
"jwtConfiguration": {
106-
"audience": [
107-
"MyApi"
108-
],
109-
"issuer": "https://www.example.com/v1/connect/oidc"
98+
"components": {
99+
"securitySchemes": {
100+
"OAuth2": {
101+
"type": "oauth2",
102+
"x-amazon-apigateway-authorizer": {
103+
"identitySource": "$request.querystring.param",
104+
"type": "jwt",
105+
"jwtConfiguration": {
106+
"audience": [
107+
"MyApi"
108+
],
109+
"issuer": "https://www.example.com/v1/connect/oidc"
110+
}
110111
}
111112
}
112113
}
113-
}
114+
},
115+
"openapi": "3.0.1"
114116
}
115117
}
116118
},
@@ -192,22 +194,24 @@
192194
}
193195
}
194196
},
195-
"openapi": "3.0.1",
196-
"securitySchemes": {
197-
"OAuth2": {
198-
"type": "oauth2",
199-
"x-amazon-apigateway-authorizer": {
200-
"identitySource": "$request.querystring.param",
201-
"type": "jwt",
202-
"jwtConfiguration": {
203-
"audience": [
204-
"MyApi"
205-
],
206-
"issuer": "https://www.example.com/v1/connect/oidc"
197+
"components": {
198+
"securitySchemes": {
199+
"OAuth2": {
200+
"type": "oauth2",
201+
"x-amazon-apigateway-authorizer": {
202+
"identitySource": "$request.querystring.param",
203+
"type": "jwt",
204+
"jwtConfiguration": {
205+
"audience": [
206+
"MyApi"
207+
],
208+
"issuer": "https://www.example.com/v1/connect/oidc"
209+
}
207210
}
208211
}
209212
}
210-
}
213+
},
214+
"openapi": "3.0.1"
211215
}
212216
}
213217
}

tests/translator/output/aws-cn/http_api_existing_openapi.json

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -174,32 +174,34 @@
174174
}
175175
}
176176
},
177-
"securitySchemes": {
178-
"oauth2Auth": {
179-
"type": "oauth2",
180-
"x-amazon-apigateway-authorizer": {
181-
"identitySource": "$request.querystring.param",
182-
"type": "jwt",
183-
"jwtConfiguration": {
184-
"audience": [
185-
"MyApi"
186-
],
187-
"issuer": "https://www.example.com/v1/connect/oidc"
177+
"components": {
178+
"securitySchemes": {
179+
"oauth2Auth": {
180+
"type": "oauth2",
181+
"x-amazon-apigateway-authorizer": {
182+
"identitySource": "$request.querystring.param",
183+
"type": "jwt",
184+
"jwtConfiguration": {
185+
"audience": [
186+
"MyApi"
187+
],
188+
"issuer": "https://www.example.com/v1/connect/oidc"
189+
}
190+
}
191+
},
192+
"OpenIdAuth": {
193+
"type": "openIdConnect",
194+
"x-amazon-apigateway-authorizer": {
195+
"identitySource": "$request.querystring.param",
196+
"type": "jwt",
197+
"jwtConfiguration": {
198+
"audience": [
199+
"MyApi"
200+
],
201+
"issuer": "https://www.example.com/v1/connect/oidc"
202+
},
203+
"openIdConnectUrl": "https://www.example.com/v1/connect"
188204
}
189-
}
190-
},
191-
"OpenIdAuth": {
192-
"type": "openIdConnect",
193-
"x-amazon-apigateway-authorizer": {
194-
"identitySource": "$request.querystring.param",
195-
"type": "jwt",
196-
"jwtConfiguration": {
197-
"audience": [
198-
"MyApi"
199-
],
200-
"issuer": "https://www.example.com/v1/connect/oidc"
201-
},
202-
"openIdConnectUrl": "https://www.example.com/v1/connect"
203205
}
204206
}
205207
},

tests/translator/output/aws-cn/http_api_existing_openapi_conditions.json

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -218,45 +218,47 @@
218218
}
219219
}
220220
},
221-
"securitySchemes": {
222-
"oauth2Auth": {
223-
"type": "oauth2",
224-
"x-amazon-apigateway-authorizer": {
225-
"identitySource": "$request.querystring.param",
226-
"type": "jwt",
227-
"jwtConfiguration": {
228-
"audience": [
229-
"MyApi"
230-
],
231-
"issuer": "https://www.example.com/v1/connect/oidc"
221+
"components": {
222+
"securitySchemes": {
223+
"oauth2Auth": {
224+
"type": "oauth2",
225+
"x-amazon-apigateway-authorizer": {
226+
"identitySource": "$request.querystring.param",
227+
"type": "jwt",
228+
"jwtConfiguration": {
229+
"audience": [
230+
"MyApi"
231+
],
232+
"issuer": "https://www.example.com/v1/connect/oidc"
233+
}
232234
}
233-
}
234-
},
235-
"OAuth2": {
236-
"type": "oauth2",
237-
"x-amazon-apigateway-authorizer": {
238-
"identitySource": "$request.querystring.param",
239-
"type": "jwt",
240-
"jwtConfiguration": {
241-
"audience": [
242-
"MyApi"
243-
],
244-
"issuer": "https://www.example.com/v1/connect/oidc"
235+
},
236+
"OAuth2": {
237+
"type": "oauth2",
238+
"x-amazon-apigateway-authorizer": {
239+
"identitySource": "$request.querystring.param",
240+
"type": "jwt",
241+
"jwtConfiguration": {
242+
"audience": [
243+
"MyApi"
244+
],
245+
"issuer": "https://www.example.com/v1/connect/oidc"
246+
}
247+
}
248+
},
249+
"OpenIdAuth": {
250+
"type": "openIdConnect",
251+
"x-amazon-apigateway-authorizer": {
252+
"identitySource": "$request.querystring.param",
253+
"type": "jwt",
254+
"jwtConfiguration": {
255+
"audience": [
256+
"MyApi"
257+
],
258+
"issuer": "https://www.example.com/v1/connect/oidc"
259+
},
260+
"openIdConnectUrl": "https://www.example.com/v1/connect"
245261
}
246-
}
247-
},
248-
"OpenIdAuth": {
249-
"type": "openIdConnect",
250-
"x-amazon-apigateway-authorizer": {
251-
"identitySource": "$request.querystring.param",
252-
"type": "jwt",
253-
"jwtConfiguration": {
254-
"audience": [
255-
"MyApi"
256-
],
257-
"issuer": "https://www.example.com/v1/connect/oidc"
258-
},
259-
"openIdConnectUrl": "https://www.example.com/v1/connect"
260262
}
261263
}
262264
},

tests/translator/output/aws-cn/implicit_http_api_auth_and_simple_case.json

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -213,36 +213,38 @@
213213
}
214214
}
215215
},
216-
"openapi": "3.0.1",
217-
"securitySchemes": {
218-
"oauth2Auth": {
219-
"type": "oauth2",
220-
"x-amazon-apigateway-authorizer": {
221-
"identitySource": "$request.querystring.param",
222-
"type": "jwt",
223-
"jwtConfiguration": {
224-
"audience": [
225-
"MyApi"
226-
],
227-
"issuer": "https://www.example.com/v1/connect/oidc"
216+
"components": {
217+
"securitySchemes": {
218+
"oauth2Auth": {
219+
"type": "oauth2",
220+
"x-amazon-apigateway-authorizer": {
221+
"identitySource": "$request.querystring.param",
222+
"type": "jwt",
223+
"jwtConfiguration": {
224+
"audience": [
225+
"MyApi"
226+
],
227+
"issuer": "https://www.example.com/v1/connect/oidc"
228+
}
229+
}
230+
},
231+
"OpenIdAuth": {
232+
"type": "openIdConnect",
233+
"x-amazon-apigateway-authorizer": {
234+
"identitySource": "$request.querystring.param",
235+
"type": "jwt",
236+
"jwtConfiguration": {
237+
"audience": [
238+
"MyApi"
239+
],
240+
"issuer": "https://www.example.com/v1/connect/oidc"
241+
},
242+
"openIdConnectUrl": "https://www.example.com/v1/connect"
228243
}
229-
}
230-
},
231-
"OpenIdAuth": {
232-
"type": "openIdConnect",
233-
"x-amazon-apigateway-authorizer": {
234-
"identitySource": "$request.querystring.param",
235-
"type": "jwt",
236-
"jwtConfiguration": {
237-
"audience": [
238-
"MyApi"
239-
],
240-
"issuer": "https://www.example.com/v1/connect/oidc"
241-
},
242-
"openIdConnectUrl": "https://www.example.com/v1/connect"
243244
}
244245
}
245-
}
246+
},
247+
"openapi": "3.0.1"
246248
}
247249
}
248250
}

0 commit comments

Comments
 (0)