-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[feature][python] Support aliasing of API keys #6469
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
Merged
spacether
merged 21 commits into
OpenAPITools:master
from
jirikuncar:jirikuncar/python-experimental/key-aliasing
Jun 11, 2020
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2b80b8a
[python] Support aliasing of API keys
jirikuncar 1b4250c
Merge remote-tracking branch 'upstream/master' into jirikuncar/python…
jirikuncar 93a7223
Support for aliasing and prefix
jirikuncar 7ae3dc6
Make more realistic usage
jirikuncar 5b8f65f
Regenerate
jirikuncar 0637df2
Merge remote-tracking branch 'upstream/master' into jirikuncar/python…
jirikuncar 116fa25
Document alias in generated code
jirikuncar eb6557e
Support override of aliased keys
jirikuncar 49a4c3d
Use diferent id and name for api keys
jirikuncar 185650a
ensure up-to-date
jirikuncar c5710b7
Simple example without x-auth-id-alias
jirikuncar 899e1f4
regenerate docs
jirikuncar 12e4f9d
Merge remote-tracking branch 'upstream/master' into jirikuncar/python…
jirikuncar b2d82c1
Regenerate
jirikuncar ea2706d
Provide separate spec for x-auth-id-alias
jirikuncar e8cdc89
Apply suggestions from code review
jirikuncar 3d5f7b7
Merge remote-tracking branch 'upstream/master' into jirikuncar/python…
jirikuncar e770aad
regenerated
jirikuncar 5527702
Merge remote-tracking branch 'upstream/master' into jirikuncar/python…
jirikuncar 2502a2c
Merge remote-tracking branch 'upstream/master' into jirikuncar/python…
jirikuncar a7a9183
Merge remote-tracking branch 'upstream/master' into jirikuncar/python…
jirikuncar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| generatorName: python-experimental | ||
| outputDir: samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/ | ||
| inputSpec: modules/openapi-generator/src/test/resources/3_0/extensions/x-auth-id-alias.yaml | ||
| templateDir: modules/openapi-generator/src/main/resources/python | ||
| additionalProperties: | ||
| packageName: x_auth_id_alias |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
modules/openapi-generator/src/test/resources/3_0/extensions/x-auth-id-alias.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| openapi: 3.0.0 | ||
| info: | ||
| description: This specification shows how to use x-auth-id-alias extension for API keys. | ||
| version: 1.0.0 | ||
| title: OpenAPI Extension x-auth-id-alias | ||
| license: | ||
| name: Apache-2.0 | ||
| url: 'https://www.apache.org/licenses/LICENSE-2.0.html' | ||
| tags: | ||
| - name: usage | ||
| description: Show usage of x-auth-id-alias | ||
| components: | ||
| securitySchemes: | ||
| api_key: | ||
| type: apiKey | ||
| name: X-Api-Key | ||
| in: header | ||
| api_key_query: | ||
| type: apiKey | ||
| name: api_key | ||
| # Test key aliasing | ||
| x-auth-id-alias: api_key | ||
| in: query | ||
| paths: | ||
| /both: | ||
| get: | ||
| tags: | ||
| - usage | ||
| summary: Use both API keys | ||
| description: Use both API keys | ||
| operationId: bothKeys | ||
| security: | ||
| - api_key_query: [] | ||
| api_key: [] | ||
| responses: | ||
| '200': | ||
| description: successful operation | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| /any: | ||
| get: | ||
| tags: | ||
| - usage | ||
| summary: Use any API key | ||
| description: Use any API key | ||
| operationId: anyKey | ||
| security: | ||
| - api_key_query: [] | ||
| - api_key: [] | ||
| responses: | ||
| '200': | ||
| description: successful operation | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| /query: | ||
| get: | ||
| tags: | ||
| - usage | ||
| summary: Use API key in query | ||
| description: Use API key in query | ||
| operationId: keyInQuery | ||
| security: | ||
| - api_key_query: [] | ||
| responses: | ||
| '200': | ||
| description: successful operation | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| /header: | ||
| get: | ||
| tags: | ||
| - usage | ||
| summary: Use API key in header | ||
| description: Use API key in header | ||
| operationId: keyInHeader | ||
| security: | ||
| - api_key: [] | ||
| responses: | ||
| '200': | ||
| description: successful operation | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| servers: | ||
| - url: 'http://{server}.swagger.io:{port}/v2' | ||
| description: petstore server | ||
| variables: | ||
| server: | ||
| enum: | ||
| - 'petstore' | ||
| - 'qa-petstore' | ||
| - 'dev-petstore' | ||
| default: 'petstore' | ||
| port: | ||
| enum: | ||
| - 80 | ||
| - 8080 | ||
| default: 80 | ||
| - url: https://localhost:8080/{version} | ||
| description: The local server | ||
| variables: | ||
| version: | ||
| enum: | ||
| - 'v1' | ||
| - 'v2' | ||
| default: 'v2' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # Byte-compiled / optimized / DLL files | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *$py.class | ||
|
|
||
| # C extensions | ||
| *.so | ||
|
|
||
| # Distribution / packaging | ||
| .Python | ||
| env/ | ||
| build/ | ||
| develop-eggs/ | ||
| dist/ | ||
| downloads/ | ||
| eggs/ | ||
| .eggs/ | ||
| lib/ | ||
| lib64/ | ||
| parts/ | ||
| sdist/ | ||
| var/ | ||
| *.egg-info/ | ||
| .installed.cfg | ||
| *.egg | ||
|
|
||
| # PyInstaller | ||
| # Usually these files are written by a python script from a template | ||
| # before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
| *.manifest | ||
| *.spec | ||
|
|
||
| # Installer logs | ||
| pip-log.txt | ||
| pip-delete-this-directory.txt | ||
|
|
||
| # Unit test / coverage reports | ||
| htmlcov/ | ||
| .tox/ | ||
| .coverage | ||
| .coverage.* | ||
| .cache | ||
| nosetests.xml | ||
| coverage.xml | ||
| *,cover | ||
| .hypothesis/ | ||
| venv/ | ||
| .venv/ | ||
| .python-version | ||
| .pytest_cache | ||
|
|
||
| # Translations | ||
| *.mo | ||
| *.pot | ||
|
|
||
| # Django stuff: | ||
| *.log | ||
|
|
||
| # Sphinx documentation | ||
| docs/_build/ | ||
|
|
||
| # PyBuilder | ||
| target/ | ||
|
|
||
| #Ipython Notebook | ||
| .ipynb_checkpoints |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.