-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
Latest release (2.5.1) breaks standard swagger ui servers definition #1119
Comments
are you using flask or aiohttp? |
I was unable to reproduce the issue.
are you overriding base_path or something? |
New in 2.5.1, the request path is introspected to support using a path-altering reverse proxy (like aws api gateway). The PR for that change is #823 |
@code-mc can you provide any more information that could help me reproduce the issue? Are you using a path-altering reverse proxy? |
I'll try to supply a minimal flask script to reproduce, we encountered this in our production units so there might be some less used openapi features in our specs |
Ok so the bug seems to be related to something else than what I initially thought which explains why it couldn't be reproduced using the info I provided. The following is a minimal example to reproduce the bug: Flask app.py:
The actual issue is that the openapi_spec_path is somehow influencing the generated "servers", which should be pulled from the servers field in the openapi spec. Resulting swagger ui: |
Thanks for providing a minimal reproducible example. This is related to the feature to support path-altering reverse-proxies #823 , and it has turned out to be surprisingly tricky... |
Description
The 2.5.1 release introduced changes which modify the raw openapi spec servers definition which results in a swagger ui deployment that generates invalid requests.
e.g. When you specify
And a path in your openapi spec:
It will generate a swagger-ui with a server "/api/resource". I suppose this is because they both share the same prefix, but this then results in the swagger ui sending requests to "/api/resource/resource/update" and "/api/resource/resource/list" instead of the expected "/api/resource/update" and "/api/resource/list".
Expected behaviour
The defined servers openapi spec property is left untouched.
Actual behaviour
The defined servers property is modified to an invalid value which breaks sending requests using swagger ui.
Steps to reproduce
See description
Additional info:
Output of the commands:
python --version
Python 3.6.9
pip show connexion | grep "^Version\:"
Version: 2.5.1
The text was updated successfully, but these errors were encountered: