Merge "in swagger operation parameter supports array type"
[releng.git] / utils / test / testapi / opnfv_testapi / tornado_swagger / handlers.py
1 ##############################################################################
2 # Copyright (c) 2016 ZTE Corporation
3 # feng.xiaowei@zte.com.cn
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 import tornado.web
10
11 from opnfv_testapi.tornado_swagger import settings
12 from opnfv_testapi.tornado_swagger import views
13
14
15 def swagger_handlers():
16     prefix = settings.docs_settings.get('swagger_prefix', '/swagger')
17     if prefix[-1] != '/':
18         prefix += '/'
19
20     def _path(suffix):
21         return prefix + suffix
22     return [
23         tornado.web.URLSpec(
24             _path(r'spec.html$'),
25             views.SwaggerUIHandler,
26             settings.docs_settings,
27             name=settings.API_DOCS_NAME),
28         tornado.web.URLSpec(
29             _path(r'resources.json$'),
30             views.SwaggerResourcesHandler,
31             settings.docs_settings,
32             name=settings.RESOURCE_LISTING_NAME),
33         tornado.web.URLSpec(
34             _path(r'APIs$'),
35             views.SwaggerApiHandler,
36             settings.docs_settings,
37             name=settings.API_DECLARATION_NAME),
38     ]