From 8a58c4e4400fe72f958904ec5f03dace5dcfa736 Mon Sep 17 00:00:00 2001 From: Felix Rindt Date: Wed, 2 Aug 2023 10:40:58 +0200 Subject: [PATCH] add missing dependency for schema generation view --- docs/api/index.rst | 2 +- ephios/api/urls.py | 18 ++++++++++++------ ephios/core/views/pwa.py | 2 +- ephios/settings.py | 2 +- poetry.lock | 2 +- pyproject.toml | 1 + 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/api/index.rst b/docs/api/index.rst index 07d22a2ae..944263729 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -91,4 +91,4 @@ that you can use to authenticate against the API endpoints described above. Endpoints --------- -.. openapi:: ephios-open-api-schema.yml \ No newline at end of file +.. openapi:: ephios-open-api-schema.yml diff --git a/ephios/api/urls.py b/ephios/api/urls.py index cbb80d6a0..92cefbcf1 100644 --- a/ephios/api/urls.py +++ b/ephios/api/urls.py @@ -1,3 +1,4 @@ +from django.conf import settings from django.urls import include, path from oauth2_provider import views as oauth2_views from rest_framework import routers @@ -19,12 +20,6 @@ app_name = "api" urlpatterns = [ - path("", include(router.urls)), - path( - "schema/", - get_schema_view(title="ephios", description="ephios API", version="1.0.0"), - name="openapi-schema", - ), path( "settings/", include( @@ -79,4 +74,15 @@ ] ), ), + path( + "schema/", + get_schema_view( + title="ephios", + description="ephios API", + version=settings.EPHIOS_VERSION, + url=settings.GET_SITE_URL(), + ), + name="openapi-schema", + ), + path("", include(router.urls)), ] diff --git a/ephios/core/views/pwa.py b/ephios/core/views/pwa.py index 552ffaaba..27ca6e47c 100644 --- a/ephios/core/views/pwa.py +++ b/ephios/core/views/pwa.py @@ -48,7 +48,7 @@ def get_context_data(self, **kwargs): context["offline_url"] = reverse("core:pwa_offline") # Cache name: we serve /static/ files with a cache first strategy, so # we need to use a new cache name when the static files change with a new ephios version. - context["cache_name"] = f"ephios-pwa-{settings.EPHIOS_VERSION}" + context["cache_name"] = f"ephios-pwa-v{settings.EPHIOS_VERSION}" return context diff --git a/ephios/settings.py b/ephios/settings.py index 209314063..12118b763 100644 --- a/ephios/settings.py +++ b/ephios/settings.py @@ -32,7 +32,7 @@ DEBUG = env.bool("DEBUG") ALLOWED_HOSTS = env.list("ALLOWED_HOSTS") -EPHIOS_VERSION = "v" + importlib_metadata.version("ephios") +EPHIOS_VERSION = importlib_metadata.version("ephios") if not DEBUG: SESSION_COOKIE_SECURE = True diff --git a/poetry.lock b/poetry.lock index d7571ed95..5a2adb312 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2445,4 +2445,4 @@ redis = ["redis"] [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "36c7011e2b19bd30445cfefe7fbd9abbde1c518216e5526843308d5f0d13b8cf" +content-hash = "2f2a11af43e71086173654b6e8f29cda7044435952800d153b03c1684c23913a" diff --git a/pyproject.toml b/pyproject.toml index 474bc1154..f5d6521df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,7 @@ redis = {version = "^4.3.4", optional = true} django-oauth-toolkit = "^2.3.0" mozilla-django-oidc = "^3.0.0" urllib3 = "^1.26.0,<2.0.0" # pinned because of poetry issues with urllib3 2.0.0 +pyyaml = "^6.0.1" [tool.poetry.extras] pgsql = ["psycopg2"]