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

🐛 Update webserver's swagger ui #6971

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
2 changes: 1 addition & 1 deletion services/web/server/requirements/_base.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ aiohttp
aiohttp_jinja2
aiohttp_security
aiohttp_session[secure]
aiohttp-swagger[performance]
aiopg[sa] # db
aiosmtplib # email
asyncpg # db
Expand All @@ -50,5 +49,6 @@ pydantic[email] # models
python-magic # excel
python-socketio # web-sockets
redis
swagger-ui-py
tenacity
twilio
41 changes: 5 additions & 36 deletions services/web/server/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@ aiohttp==3.8.5
# aiohttp-jinja2
# aiohttp-security
# aiohttp-session
# aiohttp-swagger
aiohttp-jinja2==1.5
# via -r requirements/_base.in
aiohttp-security==0.4.0
# via -r requirements/_base.in
aiohttp-session==2.11.0
# via -r requirements/_base.in
aiohttp-swagger==1.0.16
# via -r requirements/_base.in
aiopg==1.4.0
# via
# -r requirements/../../../../packages/service-library/requirements/_aiohttp.in
Expand Down Expand Up @@ -269,7 +266,7 @@ jinja2==3.1.2
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../requirements/constraints.txt
# aiohttp-jinja2
# aiohttp-swagger
# swagger-ui-py
json2html==1.3.0
# via -r requirements/_base.in
jsondiff==2.0.0
Expand Down Expand Up @@ -473,6 +470,7 @@ packaging==24.1
# -r requirements/../../../../packages/simcore-sdk/requirements/_base.in
# -r requirements/_base.in
# gunicorn
# swagger-ui-py
pamqp==3.2.1
# via aiormq
passlib==1.7.4
Expand Down Expand Up @@ -651,7 +649,7 @@ pyyaml==6.0.1
# -c requirements/../../../../requirements/constraints.txt
# -r requirements/../../../../packages/service-library/requirements/_base.in
# -r requirements/../../../../packages/simcore-sdk/requirements/../../../packages/service-library/requirements/_base.in
# aiohttp-swagger
# swagger-ui-py
redis==5.0.4
# via
# -c requirements/../../../../packages/common-library/requirements/../../../requirements/constraints.txt
Expand Down Expand Up @@ -748,6 +746,8 @@ sqlalchemy==1.4.47
# -r requirements/../../../../packages/simcore-sdk/requirements/../../../packages/postgres-database/requirements/_base.in
# aiopg
# alembic
swagger-ui-py==23.9.23
# via -r requirements/_base.in
tenacity==8.5.0
# via
# -r requirements/../../../../packages/service-library/requirements/_base.in
Expand Down Expand Up @@ -783,37 +783,6 @@ typing-extensions==4.12.2
# pydantic
# pydantic-core
# typer
ujson==5.5.0
# via
# -c requirements/../../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/models-library/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/models-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/postgres-database/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/postgres-database/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/service-library/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/service-library/requirements/../../../packages/models-library/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/service-library/requirements/../../../packages/models-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/service-library/requirements/../../../packages/settings-library/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/service-library/requirements/../../../packages/settings-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/service-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/settings-library/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/settings-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/models-library/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/models-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/postgres-database/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/postgres-database/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/service-library/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/service-library/requirements/../../../packages/models-library/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/service-library/requirements/../../../packages/models-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/service-library/requirements/../../../packages/settings-library/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/service-library/requirements/../../../packages/settings-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/service-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/settings-library/requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../packages/settings-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../packages/simcore-sdk/requirements/../../../requirements/constraints.txt
# -c requirements/../../../../requirements/constraints.txt
# aiohttp-swagger
urllib3==2.2.3
# via
# -c requirements/../../../../packages/common-library/requirements/../../../requirements/constraints.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import logging

from aiohttp import web
from aiohttp_swagger import setup_swagger # type: ignore[import-untyped]
from servicelib.aiohttp.application_setup import ModuleCategory, app_module_setup
from servicelib.aiohttp.rest_middlewares import (
envelope_middleware_factory,
error_middleware_factory,
)
from swagger_ui import api_doc # type: ignore

from .._meta import API_VTAG
from ..security.plugin import setup_security
Expand Down Expand Up @@ -60,11 +60,11 @@ def setup_rest(app: web.Application):
#
_logger.debug("OAS loaded from %s ", spec_path)
if settings.REST_SWAGGER_API_DOC_ENABLED:
setup_swagger(
app,
swagger_url="/dev/doc",
swagger_from_file=str(spec_path),
ui_version=3,
api_doc(
app=app,
url_prefix="/dev/doc",
config_path=str(spec_path),
title="Web-API doc",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from unittest.mock import Mock

import pytest
from pytest_mock import MockerFixture
from servicelib.aiohttp.application_setup import APP_SETUP_COMPLETED_KEY
from simcore_service_webserver.application_settings import setup_settings
from simcore_service_webserver.diagnostics.plugin import setup_diagnostics
Expand Down Expand Up @@ -35,12 +36,14 @@ def add_routes(self, *args, **kwargs):


@pytest.fixture
def app_mock():
def app_mock(mocker: MockerFixture):
app = MockApp()

# emulates security is initialized
app[APP_SETUP_COMPLETED_KEY] = ["simcore_service_webserver.security"]

mocker.patch("simcore_service_webserver.rest.plugin.api_doc")

return app


Expand Down
Loading