-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat: openapi support for auth usecases #949
Conversation
…efinitionbody is openapi 3
Codecov Report
@@ Coverage Diff @@
## develop #949 +/- ##
===========================================
- Coverage 94.86% 94.78% -0.08%
===========================================
Files 69 69
Lines 3055 3067 +12
Branches 573 578 +5
===========================================
+ Hits 2898 2907 +9
Misses 84 84
- Partials 73 76 +3
Continue to review full report at Codecov.
|
tests/translator/input/error_api_with_openapi_definition_body_no_flag.yaml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving. This looks good 👍
""" | ||
Convert auth components to openapi 3 in definition body if OpenApiVersion flag is specified. | ||
|
||
If there is swagger defined in the definition body, we treat it as a swagger spec and do not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: If "swagger" is defined... we use the swagger spec and do not...
definition_body['components'] = {} | ||
definition_body['components']['securitySchemes'] = definition_body['securityDefinitions'] | ||
del definition_body['securityDefinitions'] | ||
return definition_body |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next question: should we error on an else
statement here? (using openapi and not swagger, and the openapi version doesn't match a version we support).
Or is this already caught elsewhere?
StageName: SomeStage | ||
DefinitionBody: | ||
openapi: 3.1.1 | ||
swagger: 2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user wants to do this, we can let them, and allow them to deal with whatever ApiGateway thinks about it. I think this will be fine (but we definitely don't recommend doing anything of the sort).
* chore: update test_translator.py (#933) * fix: partitionalize arn in StepFunctionsExecutionPolicy (#941) * fix: fix a deprecation warning from jsonschema 3.x (#946) For example, in https://travis-ci.org/awslabs/serverless-application-model/jobs/538917819: /home/travis/build/awslabs/serverless-application-model/.tox/py36/lib/python3.6/site-packages/jsonschema/validators.py:893: DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future. cls = validator_for(schema) * feat: openapi version 3 support non-auth changes (#932) * feat: openapi support for auth usecases (#949) * chore: Fixing security alerts on the repo * addressed cr comments
Issue #, if available:
#191 #627
Description of changes:
Adding OpenApi 3.0 support for auth use cases. This adds a global/api flag called OpenApiVersion, which when specified as 3.. adds securitySchemes as per OpenApiSpec 3.
Description of how you validated changes:
End to end tests,
unit tests
deployed locally transformed template on Cfn
Checklist:
make pr
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.