summaryrefslogtreecommitdiffstats
path: root/api/server.py
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2016-12-01 01:51:16 +0000
committerchenjiankun <chenjiankun1@huawei.com>2016-12-01 07:54:03 +0000
commitccdca64bafb07057dd482cf04da7bf9e64dc1928 (patch)
tree761c7e81cc905ca330dae56b1445ff59ca0b7454 /api/server.py
parent2c9574a29c95abafb4d06eb76a18fba9930ec41b (diff)
Add swagger support for Rest API
JIRA: YARDSTICK-439 Change-Id: I36ad0663455c51d635c4329f5cbb9da25d8042e1 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'api/server.py')
-rw-r--r--api/server.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/api/server.py b/api/server.py
index 3f104c61a..64a2b4f96 100644
--- a/api/server.py
+++ b/api/server.py
@@ -10,6 +10,7 @@ import logging
from flask import Flask
from flask_restful import Api
+from flasgger import Swagger
from api.urls import urlpatterns
from yardstick import _init_logging
@@ -18,8 +19,11 @@ logger = logging.getLogger(__name__)
app = Flask(__name__)
+Swagger(app)
+
api = Api(app)
+
reduce(lambda a, b: a.add_resource(b.resource, b.url,
endpoint=b.endpoint) or a, urlpatterns, api)