skillfed

flask-openapi3

Generate REST API and OpenAPI documentation for your Flask project.

flask-openapi3 v4.3.2 609.6K downloads/30d#5,771 on PyPI268
Permissive license MIT Active released

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-openapi3

uv

uv add flask-openapi3

poetry

poetry add flask-openapi3

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: FlaskIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

flask rest api openapiautomatic api documentationpydantic flask validationswagger ui flaskopenapi spec generatorflask api frameworkinteractive api docs
openapi-specrest-apidocumentation-generation

More Dynamic Content packages