def swaggerUI(self, path): """ Customize the swagger-ui path. Defaults is <code>/swagger</code>. @param path Swagger-ui path. @return This module. """ self.__swaggerUIPath = Router.normalizePath(path) return self
def redoc(self, path): """ Customize the redoc-ui path. Defaults is <code>/redoc</code>. @param path Redoc path. @return This module. """ self.__redocPath = Router.normalizePath(path) return self
def install(self, application): directory = application.getBasePackage() if directory == None: directory = '/' else: directory = directory.replace('.', '/') appname = application.getName().replace('joopy', 'openapi') for ext in self.__format: filename = '/{}.{}'.format(appname, ext.lower()) openAPIFileLocation = Router.normalizePath(directory) + filename application.assets(self.fullPath(self.__openAPIPath, '/openapi.' + ext.lower()), \ openAPIFileLocation) """ Configure UI: """ self.configureUI(application)
def __init__(self, path='/'): """ Creates an OpenAPI module. The path is used to route the open API files. For example: <pre>{@code install(new OpenAPIModule("/docs")); }</pre> Files will be at <code>/docs/openapi.json</code>, <code>/docs/openapi.yaml</code>. @param path Custom path to use. """ self.__swaggerUIPath = '/swagger' self.__redocPath = '/redoc' self.__format = {self.Format.JSON, self.Format.YAML} # openAPIPath is const! self.__openAPIPath = Router.normalizePath(path)
def fullPath(self, contextPath, path): return Router.noTrailingSlash(Router.normalizePath(contextPath + path))