Skip to content

Commit

Permalink
Make FlaskApp instances honor Swagger UI configuration.
Browse files Browse the repository at this point in the history
Closes #161
  • Loading branch information
aholmes committed Jan 10, 2025
1 parent ed5af4c commit f8d472e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/web/Ligare/web/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import json_logging
from connexion import FlaskApp
from connexion.options import SwaggerUIOptions
from flask import Blueprint, Flask
from flask_injector import FlaskInjector
from injector import Module
Expand Down Expand Up @@ -509,8 +510,11 @@ def configure_openapi(config: Config, name: Optional[str] = None):
connexion_app = FlaskApp(
config.flask.app_name,
specification_dir=exec_dir,
# host=host,
# port=port,
swagger_ui_options=SwaggerUIOptions(
swagger_ui=config.flask.openapi.use_swagger,
swagger_ui_path=config.flask.openapi.swagger_url
or SwaggerUIOptions.swagger_ui_path,
),
)
app = connexion_app.app
config.update_flask_config(app.config)
Expand Down
4 changes: 3 additions & 1 deletion src/web/test/unit/application/test_create_openapi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def test__CreateOpenAPIApp__configure_openapi__creates_flask_app_using_config(
)
)

connexion_mock.assert_called_with(app_name, specification_dir=spec_path)
connexion_mock.assert_called()
assert connexion_mock.call_args.kwargs
assert connexion_mock.call_args.kwargs["specification_dir"] == spec_path

def test__CreateOpenAPIApp__create_app__loads_config_from_toml(
self, basic_config: Config, mocker: MockerFixture
Expand Down

0 comments on commit f8d472e

Please sign in to comment.