From 3350a872d1d868730ca4b6a660ce6ae0c3ca2d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20G=C3=B6bel?= <dgoebel@techfak.uni-bielefeld.de> Date: Thu, 9 Nov 2023 11:10:55 +0100 Subject: [PATCH] Add missing server prefix in OpenAPI schema #69 --- .pre-commit-config.yaml | 4 ++-- app/main.py | 4 +++- pyproject.toml | 2 +- requirements-dev.txt | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 16bfbe8..d98118b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,13 +15,13 @@ repos: - id: check-merge-conflict - id: check-ast - repo: https://github.com/psf/black - rev: 23.10.1 + rev: 23.11.0 hooks: - id: black files: app args: [--check] - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.1.4' + rev: 'v0.1.5' hooks: - id: ruff - repo: https://github.com/PyCQA/isort diff --git a/app/main.py b/app/main.py index 410e1d8..53f55df 100644 --- a/app/main.py +++ b/app/main.py @@ -40,8 +40,10 @@ app = FastAPI( generate_unique_id_function=custom_generate_unique_id, # license_info={"name": "MIT", "url": "https://mit-license.org/"}, root_path=settings.API_PREFIX, - openapi_url=None, # create it manuale to enable caching on client side + openapi_url=None, # create it manually to enable caching on client side ) +if settings.API_PREFIX: # pragma: no cover + app.servers.insert(0, {"url": settings.API_PREFIX}) if settings.OTLP_GRPC_ENDPOINT is not None and len(settings.OTLP_GRPC_ENDPOINT) > 0: # pragma: no cover resource = Resource(attributes={SERVICE_NAME: "clowm-s3proxy-service"}) diff --git a/pyproject.toml b/pyproject.toml index 41a45c7..7e3d3f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ line-length = 120 [tool.ruff] line-length = 120 -target-version = "py310" +target-version = "py311" [tool.mypy] plugins = ["pydantic.mypy", "sqlalchemy.ext.mypy.plugin"] diff --git a/requirements-dev.txt b/requirements-dev.txt index 2bc5b72..33c6b6f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -5,7 +5,7 @@ pytest-cov>=4.1.0,<4.2.0 coverage[toml]>=7.3.0,<7.4.0 # Linters ruff>=0.1.0,<0.2.0 -black>=23.10.0,<23.11.0 +black>=23.11.0,<23.12.0 isort>=5.12.0,<5.13.0 mypy>=1.6.0,<1.7.0 # stubs for mypy -- GitLab