Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge Release/v1.19.1 into master #1339

Merged
merged 2 commits into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samtranslator/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.19.0'
__version__ = '1.19.1'
5 changes: 3 additions & 2 deletions samtranslator/open_api/open_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, doc):

self._doc = copy.deepcopy(doc)
self.paths = self._doc["paths"]
self.security_schemes = self._doc.get("securitySchemes", {})
self.security_schemes = self._doc.get("components", {}).get("securitySchemes", {})
self.definitions = self._doc.get('definitions', {})

def get_path(self, path):
Expand Down Expand Up @@ -346,7 +346,8 @@ def openapi(self):
self._doc["paths"] = self.paths

if self.security_schemes:
self._doc["securitySchemes"] = self.security_schemes
self._doc.setdefault("components", {})
self._doc["components"]["securitySchemes"] = self.security_schemes

return copy.deepcopy(self._doc)

Expand Down
41 changes: 21 additions & 20 deletions tests/translator/input/http_api_existing_openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,24 @@ Resources:
- scope4
responses: {}
openapi: 3.0.1
securitySchemes:
oauth2Auth:
type: oauth2
x-amazon-apigateway-authorizer:
identitySource: "$request.querystring.param"
type: jwt
jwtConfiguration:
audience:
- MyApi
issuer: https://www.example.com/v1/connect/oidc
OpenIdAuth:
type: openIdConnect
x-amazon-apigateway-authorizer:
identitySource: "$request.querystring.param"
type: jwt
jwtConfiguration:
audience:
- MyApi
issuer: https://www.example.com/v1/connect/oidc
openIdConnectUrl: https://www.example.com/v1/connect
components:
securitySchemes:
oauth2Auth:
type: oauth2
x-amazon-apigateway-authorizer:
identitySource: "$request.querystring.param"
type: jwt
jwtConfiguration:
audience:
- MyApi
issuer: https://www.example.com/v1/connect/oidc
OpenIdAuth:
type: openIdConnect
x-amazon-apigateway-authorizer:
identitySource: "$request.querystring.param"
type: jwt
jwtConfiguration:
audience:
- MyApi
issuer: https://www.example.com/v1/connect/oidc
openIdConnectUrl: https://www.example.com/v1/connect
41 changes: 21 additions & 20 deletions tests/translator/input/http_api_existing_openapi_conditions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,24 @@ Resources:
- scope4
responses: {}
openapi: 3.0.1
securitySchemes:
oauth2Auth:
type: oauth2
x-amazon-apigateway-authorizer:
identitySource: "$request.querystring.param"
type: jwt
jwtConfiguration:
audience:
- MyApi
issuer: https://www.example.com/v1/connect/oidc
OpenIdAuth:
type: openIdConnect
x-amazon-apigateway-authorizer:
identitySource: "$request.querystring.param"
type: jwt
jwtConfiguration:
audience:
- MyApi
issuer: https://www.example.com/v1/connect/oidc
openIdConnectUrl: https://www.example.com/v1/connect
components:
securitySchemes:
oauth2Auth:
type: oauth2
x-amazon-apigateway-authorizer:
identitySource: "$request.querystring.param"
type: jwt
jwtConfiguration:
audience:
- MyApi
issuer: https://www.example.com/v1/connect/oidc
OpenIdAuth:
type: openIdConnect
x-amazon-apigateway-authorizer:
identitySource: "$request.querystring.param"
type: jwt
jwtConfiguration:
audience:
- MyApi
issuer: https://www.example.com/v1/connect/oidc
openIdConnectUrl: https://www.example.com/v1/connect
56 changes: 30 additions & 26 deletions tests/translator/output/aws-cn/explicit_http_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,24 @@
}
}
},
"openapi": "3.0.1",
"securitySchemes": {
"OAuth2": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
"components": {
"securitySchemes": {
"OAuth2": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
}
}
}
}
}
},
"openapi": "3.0.1"
}
}
},
Expand Down Expand Up @@ -192,22 +194,24 @@
}
}
},
"openapi": "3.0.1",
"securitySchemes": {
"OAuth2": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
"components": {
"securitySchemes": {
"OAuth2": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
}
}
}
}
}
},
"openapi": "3.0.1"
}
}
}
Expand Down
52 changes: 27 additions & 25 deletions tests/translator/output/aws-cn/http_api_existing_openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,32 +174,34 @@
}
}
},
"securitySchemes": {
"oauth2Auth": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
"components": {
"securitySchemes": {
"oauth2Auth": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
}
}
},
"OpenIdAuth": {
"type": "openIdConnect",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
},
"openIdConnectUrl": "https://www.example.com/v1/connect"
}
}
},
"OpenIdAuth": {
"type": "openIdConnect",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
},
"openIdConnectUrl": "https://www.example.com/v1/connect"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,45 +218,47 @@
}
}
},
"securitySchemes": {
"oauth2Auth": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
"components": {
"securitySchemes": {
"oauth2Auth": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
}
}
}
},
"OAuth2": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
},
"OAuth2": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
}
}
},
"OpenIdAuth": {
"type": "openIdConnect",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
},
"openIdConnectUrl": "https://www.example.com/v1/connect"
}
}
},
"OpenIdAuth": {
"type": "openIdConnect",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
},
"openIdConnectUrl": "https://www.example.com/v1/connect"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,36 +213,38 @@
}
}
},
"openapi": "3.0.1",
"securitySchemes": {
"oauth2Auth": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
"components": {
"securitySchemes": {
"oauth2Auth": {
"type": "oauth2",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
}
}
},
"OpenIdAuth": {
"type": "openIdConnect",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
},
"openIdConnectUrl": "https://www.example.com/v1/connect"
}
}
},
"OpenIdAuth": {
"type": "openIdConnect",
"x-amazon-apigateway-authorizer": {
"identitySource": "$request.querystring.param",
"type": "jwt",
"jwtConfiguration": {
"audience": [
"MyApi"
],
"issuer": "https://www.example.com/v1/connect/oidc"
},
"openIdConnectUrl": "https://www.example.com/v1/connect"
}
}
}
},
"openapi": "3.0.1"
}
}
}
Expand Down
Loading