flask-pydantic-spec
generate OpenAPI document and validate request & response with Python annotations.
Decision gist · record as of 2026-08-14
Yes, if you need OpenAPI documentation and Pydantic validation in Flask and can tolerate unclear licensing and aging maintenance. The library is low-friction to install and actively works with current Python versions (3.9–3.13), but verify the license status before use and be aware that the project shows limited community adoption (1 star, 262 days since last release). No known vulnerabilities.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low friction: pure Python wheel with only two runtime dependencies (pydantic and inflection).
- Last commit was recent; however, the project shows aging maintenance signals with only 1 star and 262 days since the last release.
License · maintenance · safety
(unclear) — License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license before using in proprietary or restricted contexts.
last release 2025-11-25 (262 days) · last repo commit 2025-12-16 · 1 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 77,274 downloads/mo, #14,542 on PyPI
Alternatives
Verify before relying
pip install flask-pydantic-spec
from flask import Flask
from pydantic import BaseModel
from flask_pydantic_spec import FlaskPydanticSpec, Response, Request
class UserModel(BaseModel):
name: str
age: int
app = Flask(__name__)
api = FlaskPydanticSpec('flask')
@app.route('/api/user', methods=['POST'])
@api.validate(body=Request(UserModel), resp=Response(HTTP_200=UserModel))
def create_user():
return {'name': 'alice', 'age': 18}
api.register(app)
app.run()- Whether the unclear license status is a blocker for your use case (no SPDX or raw license metadata available).
- Current maintenance commitment and roadmap—only 1 GitHub star and 262 days since last release suggest limited community adoption.
What it is and what it does
Flask Pydantic Spec is a library that integrates Pydantic validation and OpenAPI documentation generation into Flask applications. It lets you define request and response schemas using Pydantic models, then automatically validates incoming requests against those schemas and generates interactive API documentation (Redoc or Swagger UI). Instead of writing separate YAML specs or manual validation logic, you annotate your Flask route handlers with Pydantic models, and the library handles validation, error responses (422 on failure), and documentation generation.
The library depends on pydantic for schema definition and validation, and inflection for string transformations. It supports validation of query parameters, JSON bodies, headers, and cookies, plus response type declarations. When validation fails, it returns a 422 status with structured error details. You access validated data via a context object attached to the request, though you can also use Flask's standard request object. The library began as a fork of Spectree and aims to reduce boilerplate by combining documentation and validation in one annotation-driven interface.
Use it for
- Build a REST API with automatic OpenAPI documentation and request validation without writing separate spec files.
- Validate incoming JSON payloads and query parameters against Pydantic models, returning 422 errors with detailed validation messages.
- Generate interactive Swagger UI or Redoc documentation automatically from your Flask route annotations.
- Enforce consistent request/response schemas across a Flask application using Pydantic's validation and serialization.
- Add before/after hooks to validation to log failures, record metrics, or customize error responses per endpoint.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need OpenAPI documentation and Pydantic validation in Flask and can tolerate unclear licensing and aging maintenance.
The library is low-friction to install and actively works with current Python versions (3.9–3.13), but verify the license status before use and be aware that the project shows limited community adoption (1 star, 262 days since last release). No known vulnerabilities.
Install
flask-pydantic-spec on PyPI
Before you install
Low friction: pure Python wheel with only two runtime dependencies (pydantic and inflection). Last commit was recent; however, the project shows aging maintenance signals with only 1 star and 262 days since the last release.
Requires Python 3.9 or later.
License in practice
License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license before using in proprietary or restricted contexts.
Quickstart
pip install flask-pydantic-spec
from flask import Flask
from pydantic import BaseModel
from flask_pydantic_spec import FlaskPydanticSpec, Response, Request
class UserModel(BaseModel):
name: str
age: int
app = Flask(__name__)
api = FlaskPydanticSpec('flask')
@app.route('/api/user', methods=['POST'])
@api.validate(body=Request(UserModel), resp=Response(HTTP_200=UserModel))
def create_user():
return {'name': 'alice', 'age': 18}
api.register(app)
app.run()
Verify before relying
- Whether the unclear license status is a blocker for your use case (no SPDX or raw license metadata available).
- Current maintenance commitment and roadmap—only 1 GitHub star and 262 days since last release suggest limited community adoption.
Package facts
| License | Not declared unclear |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespydanticinflection |
| Maintenance | Aging 262 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 77,274 / month, #14,542 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Operating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules |
Evidence: flask_pydantic_spec-0.8.7-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “api spec generation python”
- flask-pydantic-specAdds OpenAPI documentation generation and request/response validation…
- openapi-generator-cliProvides a Python CLI wrapper for OpenAPI Generator, enabling…
- apispec-oneofschemaExtends apispec to generate OpenAPI 3.0+ documentation for…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also flask-openapi3 · Flask-Pydantic · spectree · openapi-pydantic · openapi-schema-pydantic · quart-schema · pydantic-handlebars · APIFlask · sanic-ext · flask-swagger