flask-openapi3
Generate REST API and OpenAPI documentation for your Flask project.
What it is and what it does
Flask-OpenAPI3 extends Flask with built-in OpenAPI 3.1.0 support and automatic interactive documentation. It wraps request/response handling with Pydantic models for type validation and serialization, eliminating manual schema definition. The framework generates Swagger, Redoc, RapiDoc, RapiPdf, Scalar, and Elements UI automatically, making API contracts visible to clients and developers without extra work.
The package supports both function-based and class-based API views, path/query/body parameter validation, and optional async/await support via asgiref. It's designed for developers who want Flask's simplicity with OpenAPI's documentation and validation guarantees, reducing boilerplate while keeping the Flask development experience intact.
Use it for:
- Build a microservice with automatic Swagger documentation visible at /openapi without writing YAML.
- Validate incoming JSON payloads against Pydantic schemas and reject malformed requests automatically.
- Generate client SDKs or test suites from the live OpenAPI spec served by your Flask app.
- Migrate a Flask project to OpenAPI compliance by wrapping existing routes with Pydantic models.
- Create a REST API where request/response types are enforced at runtime and documented in one place.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Builds REST APIs on Flask with automatic OpenAPI documentation and Pydantic-based request/response validation.
Yes. Low install friction, active maintenance, no known vulnerabilities, permissive MIT license, and a focused scope—Flask + Pydantic + OpenAPI docs—make this a solid choice for REST APIs that need automatic documentation and validation. Best fit for teams already using Flask who want OpenAPI compliance without switching frameworks.
Install
flask-openapi3 on PyPI
pip
pip install flask-openapi3uv
uv add flask-openapi3poetry
poetry add flask-openapi3Installing flask-openapi3
Before you install
Low friction: pure Python wheel, only two runtime dependencies (Flask and Pydantic). Actively maintained with recent commits and stable production status.
License in practice
MIT license permits commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install flask-openapi3
from pydantic import BaseModel
from flask_openapi3 import OpenAPI, Info
info = Info(title="My API", version="1.0.0")
app = OpenAPI(__name__, info=info)
class QueryModel(BaseModel):
name: str
@app.get("/hello")
def hello(query: QueryModel):
return {"message": f"Hello {query.name}"}
if __name__ == "__main__":
app.run()
Requires Python 3.10 or later.
Verify before relying
- Performance characteristics under high request volume or with large payloads.
- Compatibility with specific Flask extensions or middleware patterns.
- Completeness of OpenAPI 3.1.0 specification coverage in edge cases.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — flask, pydantic |
| Maintenance | actively maintained — 97 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 609,606/month — #5,771 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flask_openapi3-4.3.2-py3-none-any.whl
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
APIFlaskAPIFlask is a lightweight web API framework…
permissive · top 15,000 on PyPI
connexionConnexion builds REST APIs from OpenAPI/Swagger…
permissive · top 5,000 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
flask-openapi3-swaggerProvides Swagger UI integration for…
permissive · top 15,000 on PyPI
flask-pydantic-specAdds OpenAPI documentation generation and…
unclear · top 15,000 on PyPI
django-ninjaDjango Ninja builds type-hint-based REST APIs…
permissive · top 5,000 on PyPI
Flask-PydanticAdds Pydantic model validation to Flask route…
permissive · top 15,000 on PyPI
quart-schemaQuart-Schema adds schema validation and…
permissive · top 15,000 on PyPI
aiopenapi3Parses and validates OpenAPI 3 specifications…
permissive · top 15,000 on PyPI
flask-openapi3-elementsProvides the Stoplight Elements UI for…
permissive · top 15,000 on PyPI