Documentation¶
Awokado allows to generate documentation for a project using swagger(3rd version). To generate documentation you need to import add route with SwaggerResource after adding all other routes. Also, you can choose UI for swagger (SwaggerUI or Redoc) by adding route for resoruces SwaggerUIResource or RedocViewResource
-
class
awokado.documentation.
SwaggerResource
¶ -
__init__
(api: falcon.api.API, project_name: str, api_hosts: Union[str, Sequence[str]] = '/', api_version: str = '1.0.0', description: str = '')¶ Resource for ‘/swagger.yaml’
Parameters: - api – Your falcon.API instance
- project_name – Title for your documentation
- api_hosts – List of places where api can be
- api_version – String with number of version of you project
- description – Absolute path to template with description of your project
-
-
class
awokado.documentation.
SwaggerUIResource
¶
-
class
awokado.documentation.
RedocViewResource
¶
Examples¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | from awokado.documentation import generate_documentation
from dynaconf import settings
from api.routes import api
api.add_route(
"/swagger.yaml",
ApiResource(
api=api,
project_name="Example Documentation",
api_host=('http://example.com/api', '/'),
api_version="4.2.0",
description="Some api description and introducing words"
)
)
# You can choose one
api.add_route("/doc", SwaggerUIResource("/swagger.yaml"))
api.add_route("/redoc", RedocViewResource("/swagger.yaml"))
|