Skip to content
Snippets Groups Projects

GREG-25: Adding namespace versioning

Merged Tore.Brede requested to merge GREG-25_add_api_versioning into master
+ 17
1
@@ -16,9 +16,25 @@ Including another URLconf
from typing import List
from django.urls import path, include
from django.urls.resolvers import URLResolver
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
from rest_framework.versioning import NamespaceVersioning
from greg.api import urls as api_urls
from greg.api.views.health import Health
urlpatterns: List[URLResolver] = [
path("api/", include(api_urls.urlpatterns)),
path(
"schema/",
SpectacularAPIView.as_view(versioning_class=NamespaceVersioning),
name="schema",
), # type: ignore
path(
"schema/swagger-ui/",
SpectacularSwaggerView.as_view(
url_name="schema", versioning_class=NamespaceVersioning
), # type: ignore
name="swagger-ui",
),
path("health/", Health.as_view()), # type: ignore
path("api/v1/", include((api_urls.urlpatterns, "greg"), namespace="v1")),
]
Loading