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

Switch to own maintained version of swagger-ui #1619

Merged
merged 1 commit into from
Jan 9, 2023
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
7 changes: 3 additions & 4 deletions connexion/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from typing import Optional # NOQA

try:
from swagger_ui_bundle import swagger_ui_2_path, swagger_ui_3_path
from py_swagger_ui import swagger_ui_path
except ImportError:
swagger_ui_2_path = swagger_ui_3_path = None
swagger_ui_path = None

from connexion.uri_parsing import AbstractURIParser

Expand All @@ -26,12 +26,11 @@ class ConnexionOptions:
def __init__(self, options=None, oas_version=(2,)):
self._options = {}
self.oas_version = oas_version
self.swagger_ui_local_path = swagger_ui_path
if self.oas_version >= (3, 0, 0):
self.openapi_spec_name = "/openapi.json"
self.swagger_ui_local_path = swagger_ui_3_path
else:
self.openapi_spec_name = "/swagger.json"
self.swagger_ui_local_path = swagger_ui_2_path

if options:
self._options.update(filter_values(options))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def read_version(package):
'python-multipart>=0.0.5',
]

swagger_ui_require = 'swagger-ui-bundle>=0.0.2,<0.1'
swagger_ui_require = 'py-swagger-ui>=1.1.0,<2'

flask_require = [
'flask[async]>=2.2,<3',
Expand Down
2 changes: 1 addition & 1 deletion tests/api/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_openapi_yaml_behind_proxy(reverse_proxied_app):
spec = yaml.load(openapi_yaml.data.decode("utf-8"), Loader=yaml.BaseLoader)

if reverse_proxied_app._spec_file == "swagger.yaml":
assert b'url = "/behind/proxy/v1.0/swagger.json"' in swagger_ui.data
assert b'url: "/behind/proxy/v1.0/swagger.json"' in swagger_ui.data
assert (
spec.get("basePath") == "/behind/proxy/v1.0"
), "basePath should contains original URI"
Expand Down