Your Python Flask API is Nothing Without Swagger UI.
You don’t believe me, look at this.
Much better.
Once you’ve created the Swagger UI layer, your API documentation is much more presentable to pass onto your line managers, colleagues and third party consumers.
This is a Python Flask Specific implementation. It is expected that you already have at least a minimal Flask REST API with a few end points ready to be documented. If not, you can get the code from here, https://github.com/Sean-Bradley/Seans-Python3-Flask-Rest-Boilerplate
and then run # pip install -r requirements.txt
Lets get Started
- Open console or bash
# pip install flask_swagger_ui
- Open your
app.py
where you instantiated Flask and add to the topfrom flask_swagger_ui import get_swaggerui_blueprint
- Add a folder to the root of your project and name it
static
.
4. Create a new file in it and name it swagger.json
5. Add some Swagger specific blueprint code after you instantiate Flask