summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2017-05-10 10:09:21 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2017-05-10 11:03:34 +0800
commit942e19eca5228602a2ee73b0d4ef12d2e04ee6f1 (patch)
tree6a81c704561f32b0abfe6b9d6f10bf2c3af514dd /utils
parent9156b12831162f63453d75376d8db0074266c658 (diff)
change swagger urls based on v1.2 specification
According to swagger1.2 specification, The Swagger specification is comprised of two file types: The Resources Listing and The API Declaration. https://github.com/OAI/OpenAPI-Specification/blob/master/versions/1.2.md Change-Id: I8f92897e41dbf6d4d2c3b1fe64ea6729f04cf3ad Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils')
-rw-r--r--utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py10
-rw-r--r--utils/test/testapi/opnfv_testapi/tornado_swagger/settings.py4
-rw-r--r--utils/test/testapi/opnfv_testapi/tornado_swagger/views.py7
3 files changed, 11 insertions, 10 deletions
diff --git a/utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py b/utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py
index 2154b4697..af0b515ad 100644
--- a/utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py
+++ b/utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py
@@ -9,7 +9,7 @@
from tornado.web import URLSpec, StaticFileHandler
from settings import default_settings, \
- SWAGGER_API_DOCS, SWAGGER_API_LIST, SWAGGER_API_SPEC
+ SWAGGER_API_DOCS, SWAGGER_RESOURCE_LISTING, SWAGGER_API_DECLARATION
from views import SwaggerUIHandler, SwaggerResourcesHandler, SwaggerApiHandler
@@ -27,15 +27,15 @@ def swagger_handlers():
default_settings,
name=SWAGGER_API_DOCS),
URLSpec(
- _path(r'spec.json$'),
+ _path(r'resources.json$'),
SwaggerResourcesHandler,
default_settings,
- name=SWAGGER_API_LIST),
+ name=SWAGGER_RESOURCE_LISTING),
URLSpec(
- _path(r'spec$'),
+ _path(r'APIs$'),
SwaggerApiHandler,
default_settings,
- name=SWAGGER_API_SPEC),
+ name=SWAGGER_API_DECLARATION),
(
_path(r'(.*\.(css|png|gif|js))'),
StaticFileHandler,
diff --git a/utils/test/testapi/opnfv_testapi/tornado_swagger/settings.py b/utils/test/testapi/opnfv_testapi/tornado_swagger/settings.py
index 88d0d0f88..753029709 100644
--- a/utils/test/testapi/opnfv_testapi/tornado_swagger/settings.py
+++ b/utils/test/testapi/opnfv_testapi/tornado_swagger/settings.py
@@ -10,8 +10,8 @@ import os.path
SWAGGER_VERSION = '1.2'
SWAGGER_API_DOCS = 'swagger-api-docs'
-SWAGGER_API_LIST = 'swagger-api-list'
-SWAGGER_API_SPEC = 'swagger-api-spec'
+SWAGGER_RESOURCE_LISTING = 'swagger-resource-listing'
+SWAGGER_API_DECLARATION = 'swagger-api-declaration'
STATIC_PATH = os.path.join(os.path.dirname(os.path.normpath(__file__)),
'static')
diff --git a/utils/test/testapi/opnfv_testapi/tornado_swagger/views.py b/utils/test/testapi/opnfv_testapi/tornado_swagger/views.py
index 25083195b..2168c5e91 100644
--- a/utils/test/testapi/opnfv_testapi/tornado_swagger/views.py
+++ b/utils/test/testapi/opnfv_testapi/tornado_swagger/views.py
@@ -12,7 +12,8 @@ import json
import tornado.template
import tornado.web
-from settings import SWAGGER_VERSION, SWAGGER_API_LIST, SWAGGER_API_SPEC
+from settings import SWAGGER_VERSION
+from settings import SWAGGER_RESOURCE_LISTING, SWAGGER_API_DECLARATION
from settings import models, basePath
@@ -29,7 +30,7 @@ class SwaggerUIHandler(tornado.web.RequestHandler):
return self.static_path
def get(self):
- discovery_url = basePath() + self.reverse_url(SWAGGER_API_LIST)
+ discovery_url = basePath() + self.reverse_url(SWAGGER_RESOURCE_LISTING)
self.render('index.html', discovery_url=discovery_url)
@@ -47,7 +48,7 @@ class SwaggerResourcesHandler(tornado.web.RequestHandler):
'produces': ["application/json"],
'description': 'Test Api Spec',
'apis': [{
- 'path': self.reverse_url(SWAGGER_API_SPEC),
+ 'path': self.reverse_url(SWAGGER_API_DECLARATION),
'description': 'Test Api Spec'
}]
}