Applying OpenAPI 3.x specification with Swagger
Aside from instrumentation, some solutions provide well-formatted API documentation, as in FastAPI. One of these solutions is to use flask_openapi3, which applies OpenAPI 3.x specification to implement Flask components and document the API endpoints with Swagger, ReDoc, and RapiDoc.
flask_openapi3 is not a library or dependency module of Flask but a separate framework based on the current Flask 3.x with the pydantic module to support OpenAPI documentation. It also supports Flask[async] components.
After installing flask_openapi3 using the pip command, replace the Flask class with OpenAPI and Blueprint with APIBlueprint. These are still the original Flask classes but with the feature of adding API documentation. The following is the create_app() factory method of our main Flask application that uses OpenAPI to create the application object with the added documentation components:
from flask_openapi3 import Info from flask_openapi3...