# -*- coding: utf-8 -*-
from __future__ import absolute_import
+from typing import Any, Dict, Union
import logging
import cherrypy
if endpoint.is_api or all_endpoints:
list_of_ctrl.add(endpoint.ctrl)
- tag_map = {}
+ tag_map: Dict[str, str] = {}
for ctrl in list_of_ctrl:
tag_name = ctrl.__name__
tag_descr = ""
@classmethod
def _gen_responses(cls, method, resp_object=None):
- resp = {
+ resp: Dict[str, Dict[str, Union[str, Any]]] = {
'400': {
"description": "Operation exception. Please check the "
"response body for details."
return parameters
@classmethod
- def _gen_paths(cls, all_endpoints, base_url):
+ def _gen_paths(cls, all_endpoints):
method_order = ['get', 'post', 'put', 'delete']
paths = {}
for path, endpoints in sorted(list(ENDPOINT_MAP.items()),
methods[method.lower()]['security'] = [{'jwt': []}]
if not skip:
- paths[path[len(base_url):]] = methods
+ paths[path] = methods
return paths
host = host[host.index(':')+3:]
logger.debug("Host: %s", host)
- paths = self._gen_paths(all_endpoints, base_url)
+ paths = self._gen_paths(all_endpoints)
if not base_url:
base_url = "/"
@Endpoint(path="api.json")
def api_json(self):
- return self._gen_spec(False, "/api")
+ return self._gen_spec(False, "/")
@Endpoint(path="api-all.json")
def api_all_json(self):
- return self._gen_spec(True, "/api")
+ return self._gen_spec(True, "/")
def _swagger_ui_page(self, all_endpoints=False, token=None):
base = cherrypy.request.base