-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from kartoza/add_swagger
Add swagger
- Loading branch information
Showing
4 changed files
with
38 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,29 @@ | |
from rest_framework.routers import DefaultRouter | ||
from rest_framework_nested.routers import NestedSimpleRouter | ||
|
||
from rest_framework import permissions | ||
from drf_yasg.views import get_schema_view | ||
from drf_yasg import openapi | ||
|
||
from cloud_native_gis.api.layer import ( | ||
LayerViewSet, LayerStyleViewSet | ||
) | ||
from cloud_native_gis.api.vector_tile import (VectorTileLayer) | ||
|
||
schema_view = get_schema_view( | ||
openapi.Info( | ||
title="Cloud Native GIS API", | ||
default_version='v1', | ||
description="API documentation for the Cloud Native GIS project", | ||
terms_of_service="https://www.example.com/terms/", | ||
contact=openapi.Contact(email="[email protected]"), | ||
license=openapi.License(name="BSD License"), | ||
), | ||
public=True, | ||
permission_classes=(permissions.AllowAny,), | ||
) | ||
|
||
|
||
router = DefaultRouter() | ||
router.register( | ||
r'layer', LayerViewSet, basename='cloud-native-gis-layer' | ||
|
@@ -35,5 +53,11 @@ | |
'maputnik/', | ||
TemplateView.as_view(template_name='cloud_native_gis/maputnik.html'), | ||
name='cloud-native-gis-maputnik' | ||
) | ||
), | ||
path('swagger/', | ||
schema_view.with_ui('swagger', cache_timeout=0), | ||
name='schema-swagger-ui'), | ||
path('redoc/', | ||
schema_view.with_ui('redoc', cache_timeout=0), | ||
name='schema-redoc-ui'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters