summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2018-04-13 10:33:37 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2018-04-13 10:33:37 +0800
commit3e700e58c66468b63ced3bd69cb3c98f0367e05d (patch)
tree41d2999b488286c369aac3c72458bac93587c9e6
parenta499e299107b3776d0e32c88e545940e94cb0a08 (diff)
Change vfc-catalog swagger url directory
Change-Id: I2006b5132044be04ece5c9422db8bdff0ae868ae Issue-ID: VFC-877 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--catalog/settings.py6
-rw-r--r--catalog/swagger/urls.py26
-rw-r--r--catalog/urls.py35
3 files changed, 27 insertions, 40 deletions
diff --git a/catalog/settings.py b/catalog/settings.py
index ff19ff25..30b7db08 100644
--- a/catalog/settings.py
+++ b/catalog/settings.py
@@ -50,7 +50,6 @@ INSTALLED_APPS = [
'catalog.pub.database',
'catalog.samples',
'catalog.swagger',
-
'drf_yasg',
]
@@ -58,8 +57,7 @@ INSTALLED_APPS = [
SWAGGER_SETTINGS = {
'LOGIN_URL': '/admin/login',
'LOGOUT_URL': '/admin/logout',
-
- 'DEFAULT_INFO': 'catalog.urls.swagger_info'
+ 'DEFAULT_INFO': 'catalog.swagger.urls.swagger_info'
}
TEMPLATES = [
@@ -102,8 +100,6 @@ REST_FRAMEWORK = {
'DEFAULT_PARSER_CLASSES': (
'rest_framework.parsers.JSONParser',
'rest_framework.parsers.MultiPartParser',
- # 'rest_framework.parsers.FormParser',
- # 'rest_framework.parsers.FileUploadParser',
)
}
diff --git a/catalog/swagger/urls.py b/catalog/swagger/urls.py
index b5e91f07..146cb040 100644
--- a/catalog/swagger/urls.py
+++ b/catalog/swagger/urls.py
@@ -13,9 +13,33 @@
# limitations under the License.
from django.conf.urls import url
+from drf_yasg import openapi
+from drf_yasg.views import get_schema_view
+from rest_framework import permissions
from catalog.swagger.views import SwaggerJsonView
+# Add code for generating swagger automatically.
+swagger_info = openapi.Info(
+ title="VFC Catalog API",
+ default_version='v1',
+ description="""
+
+The `swagger-ui` view can be found [here](/api/vnflcm/v1/swagger).
+The `ReDoc` view can be found [here](/api/vnflcm/v1/redoc).
+The swagger YAML document can be found [here](/api/vnflcm/v1/swagger.yaml).
+The swagger JSON document can be found [here](/api/vnflcm/v1/swagger.json)."""
+)
+
+SchemaView = get_schema_view(
+ validators=['ssv', 'flex'],
+ public=True,
+ permission_classes=(permissions.AllowAny,),
+)
+
urlpatterns = [
- url(r'^api/catalog/v1/swagger.json$', SwaggerJsonView.as_view())
+ url(r'^api/catalog/v1/swagger.json$', SwaggerJsonView.as_view()),
+ url(r'^swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'),
+ url(r'^swagger/$', SchemaView.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
+ url(r'^redoc/$', SchemaView.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
]
diff --git a/catalog/urls.py b/catalog/urls.py
index 291e9f92..6b4abf1e 100644
--- a/catalog/urls.py
+++ b/catalog/urls.py
@@ -13,43 +13,10 @@
# limitations under the License.
from django.conf.urls import include, url
-from catalog.pub.config.config import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM
-from rest_framework import permissions
-
-from drf_yasg import openapi
-from drf_yasg.views import get_schema_view
-
-
-# Add code for generating swagger automatically.
-swagger_info = openapi.Info(
- title="Snippets API",
- default_version='v1',
- description="""This is a VFC project for the catalog."""
-)
-
-SchemaView = get_schema_view(
- validators=['ssv', 'flex'],
- public=True,
- permission_classes=(permissions.AllowAny,),
-)
+from catalog.pub.config.config import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM
urlpatterns = [
-
- # Add code for generating swagger automatically.
- url(r'^swagger(?P<format>.json|.yaml)$',
- SchemaView.without_ui(cache_timeout=0),
- name='schema-json'),
- url(r'^swagger/$', SchemaView.with_ui('swagger',
- cache_timeout=0), name='schema-swagger-ui'),
- url(r'^redoc/$', SchemaView.with_ui('redoc',
- cache_timeout=0), name='schema-redoc'),
- url(r'^cached/swagger(?P<format>.json|.yaml)$',
- SchemaView.without_ui(cache_timeout=None), name='cschema-json'),
- url(r'^cached/swagger/$', SchemaView.with_ui('swagger',
- cache_timeout=None), name='cschema-swagger-ui'),
- url(r'^cached/redoc/$', SchemaView.with_ui('redoc',
- cache_timeout=None), name='cschema-redoc'),
url(r'^', include('catalog.samples.urls')),
url(r'^', include('catalog.packages.urls')),
url(r'^', include('catalog.jobs.urls')),