summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2018-02-05 18:48:55 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2018-02-06 09:00:22 +0800
commit081ea32d4f41aee93dc5dbb82c7bc6ca0a38a288 (patch)
tree148bce07454825f162266a2624f4627ba2a5309b
parent4fa4bf025bd94590915d5678c6f1749f403d9655 (diff)
Add vfc-ztevnfmdriver swagger urls
Change-Id: Ic3211166d2b79d24cf1b1ec67de14810cdf98fbd Issue-ID: VFC-736 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--zte/vmanager/driver/swagger/urls.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/zte/vmanager/driver/swagger/urls.py b/zte/vmanager/driver/swagger/urls.py
index 39c0febc..dc377d31 100644
--- a/zte/vmanager/driver/swagger/urls.py
+++ b/zte/vmanager/driver/swagger/urls.py
@@ -14,19 +14,29 @@
from django.conf.urls import url
from drf_yasg import openapi
-
-from driver.swagger import views
+from drf_yasg.views import get_schema_view
+from rest_framework import permissions
swagger_info = openapi.Info(
- title="vfc-vnfmgr API",
+ title="vfc-ztevnfmdriver API",
default_version='v1',
description="""
-The `swagger-ui` view can be found [here](/swagger).
-The `ReDoc` view can be found [here](/redoc).
-The swagger YAML document can be found [here](/swagger.yaml)."""
+The `swagger-ui` view can be found [here](/api/ztevnfmdriver/v1/swagger).
+The `ReDoc` view can be found [here](/api/ztevnfmdriver/v1/redoc).
+The swagger YAML document can be found [here](/api/ztevnfmdriver/v1/swagger.yaml).
+The swagger JSON document can be found [here](/api/ztevnfmdriver/v1/swagger.json)."""
+)
+
+SchemaView = get_schema_view(
+ validators=['ssv', 'flex'],
+ public=True,
+ permission_classes=(permissions.AllowAny,),
)
urlpatterns = [
- url(r'^api/ztevnfmdriver/v1/swagger.json$', views.SwaggerView.as_view()),
+ # url(r'^api/ztevnfmdriver/v1/swagger.json$', views.SwaggerView.as_view()),
+ url(r'^api/ztevnfmdriver/v1/swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'),
+ url(r'^api/ztevnfmdriver/v1/swagger$', SchemaView.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
+ url(r'^api/ztevnfmdriver/v1/redoc$', SchemaView.with_ui('redoc', cache_timeout=0), name='schema-redoc')
]