summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/tornado_swagger
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
commitd12a70a7eebf025b90f46eaa8a5fee38ecadc518 (patch)
tree2dffebe3967e31d740d73f9e04d5d074bba42657 /testapi/opnfv_testapi/tornado_swagger
parent85e300333158bb5ffb0814ad124708f9d62dadb3 (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 'testapi/opnfv_testapi/tornado_swagger')
-rw-r--r--testapi/opnfv_testapi/tornado_swagger/handlers.py10
-rw-r--r--testapi/opnfv_testapi/tornado_swagger/settings.py4
-rw-r--r--testapi/opnfv_testapi/tornado_swagger/views.py7
3 files changed, 11 insertions, 10 deletions
diff --git a/testapi/opnfv_testapi/tornado_swagger/handlers.py b/testapi/opnfv_testapi/tornado_swagger/handlers.py
index 2154b46..af0b515 100644
--- a/testapi/opnfv_testapi/tornado_swagger/handlers.py
+++ b/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/testapi/opnfv_testapi/tornado_swagger/settings.py b/testapi/opnfv_testapi/tornado_swagger/settings.py
index 88d0d0f..7530297 100644
--- a/testapi/opnfv_testapi/tornado_swagger/settings.py
+++ b/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/testapi/opnfv_testapi/tornado_swagger/views.py b/testapi/opnfv_testapi/tornado_swagger/views.py
index 2508319..2168c5e 100644
--- a/testapi/opnfv_testapi/tornado_swagger/views.py
+++ b/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'
}]
}