diff --git a/README.md b/README.md index f7c5927..0a022e9 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ $env:FLASK_APP="application.py" # or set the var in `.env` python -m flask run #(use -p to specify binding port) ``` +NOTE: the swagger docs is at http://localhost:5000/docs/swagger ## Todo List diff --git a/config.py b/config.py index 68421e6..2cd1433 100644 --- a/config.py +++ b/config.py @@ -1,6 +1,8 @@ import logging import os +from tools.openapi_default import SPEC_OPTIONS + log = logging.getLogger(__name__) @@ -21,6 +23,7 @@ class Config: OPENAPI_URL_PREFIX = '/docs' OPENAPI_SWAGGER_UI_PATH = '/swagger' OPENAPI_SWAGGER_UI_VERSION = '3.23.4' + API_SPEC_OPTIONS = SPEC_OPTIONS PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) diff --git a/tools/openapi_default.py b/tools/openapi_default.py new file mode 100644 index 0000000..0142921 --- /dev/null +++ b/tools/openapi_default.py @@ -0,0 +1,10 @@ +SPEC_OPTIONS = { + 'info': {'description': 'Server API document'}, + 'servers': [ + { + 'url': 'http://localhost:{port}/', + 'description': 'The development API server', + 'variables': {'port': {'enum': ['5000', '8888'], 'default': '5000'}}, + } + ], +}