openapi-schema-pydantic
OpenAPI (v3) specification schema as pydantic class
Decision gist · record as of 2026-08-14
Yes, with conditions. The package is stable and widely used, but maintenance is dormant—last release was 2022-06-29. Install it if you need to work with OpenAPI specs in Python and can tolerate slow or no updates. Verify compatibility with your Pydantic version and confirm that OpenAPI 3.0.3 or 3.1.0 support meets your needs. No known security vulnerabilities.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >=3.6.1; when serializing to JSON, must use by_alias=True and exclude_none=True to comply with OpenAPI standard.
- Low install friction with a single runtime dependency.
- Maintenance is dormant—last release was 2022-06-29, though the repository remains active and the package is widely used.
License · maintenance · safety
permissive license (permissive) — MIT License (permissive). No restrictions on commercial or private use; you may modify and distribute freely with attribution.
last release 2022-06-29 (1507 days) · last repo commit 2024-07-03 · 122 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,085,006 downloads/mo, #4,387 on PyPI
Alternatives
Verify before relying
pip install openapi-schema-pydantic
from openapi_schema_pydantic import OpenAPI, Info, Operation, Response
open_api = OpenAPI(
info=Info(title="My API", version="v1"),
paths={"/ping": {"get": Operation(responses={"200": Response(description="pong")})}}
)
print(open_api.json(by_alias=True, exclude_none=True))- Whether dormant maintenance status affects compatibility with recent OpenAPI spec updates or pydantic breaking changes.
- Support level for OpenAPI 3.1.0 vs 3.0.3 in production environments and tooling ecosystem.
- Compatibility with current versions of pydantic, especially pydantic v2.
What it is and what it does
openapi-schema-pydantic wraps the OpenAPI v3 specification as a set of Pydantic data classes, letting you build and validate OpenAPI documents programmatically in Python. Instead of hand-writing JSON or YAML specs, you instantiate Pydantic objects (OpenAPI, Info, Operation, Response, etc.) that follow the official schema naming and structure, then serialize them to spec-compliant JSON or dict.
The package leverages Pydantic's validation and schema generation to handle the complexity of OpenAPI's nested structure. It supports both object-oriented construction and mixed dict/object input, and includes utilities to embed Pydantic model schemas directly into OpenAPI documents as JSON Schema references. It offers both OpenAPI 3.1.0 and 3.0.3 versions via separate import paths.
Use it for
- Generate OpenAPI specs programmatically from Python code instead of maintaining separate YAML/JSON files.
- Validate OpenAPI documents at runtime using Pydantic's built-in validation before publishing or serving them.
- Embed Pydantic model schemas into OpenAPI definitions to keep request/response types in sync with your code.
- Build API documentation tooling that constructs OpenAPI specs from Python function signatures and type hints.
- Migrate or transform existing OpenAPI specs by parsing them into Pydantic objects, modifying them, and re-serializing.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, with conditions.
The package is stable and widely used, but maintenance is dormant—last release was 2022-06-29. Install it if you need to work with OpenAPI specs in Python and can tolerate slow or no updates. Verify compatibility with your Pydantic version and confirm that OpenAPI 3.0.3 or 3.1.0 support meets your needs. No known security vulnerabilities.
Install
openapi-schema-pydantic on PyPI
Before you install
Low install friction with a single runtime dependency. Maintenance is dormant—last release was 2022-06-29, though the repository remains active and the package is widely used.
Requires Python >=3.6.1; when serializing to JSON, must use by_alias=True and exclude_none=True to comply with OpenAPI standard.
License in practice
MIT License (permissive). No restrictions on commercial or private use; you may modify and distribute freely with attribution.
Quickstart
pip install openapi-schema-pydantic
from openapi_schema_pydantic import OpenAPI, Info, Operation, Response
open_api = OpenAPI(
info=Info(title="My API", version="v1"),
paths={"/ping": {"get": Operation(responses={"200": Response(description="pong")})}}
)
print(open_api.json(by_alias=True, exclude_none=True))
Verify before relying
- Whether dormant maintenance status affects compatibility with recent OpenAPI spec updates or pydantic breaking changes.
- Support level for OpenAPI 3.1.0 vs 3.0.3 in production environments and tooling ecosystem.
- Compatibility with current versions of pydantic, especially pydantic v2.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.6.1 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepydantic |
| Maintenance | Dormant 1,507 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,085,006 / month, #4,387 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: openapi_schema_pydantic-1.2.4-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 › “openapi v3 specification classes”
- openapi-schema-pydanticProvides Pydantic classes that map to the OpenAPI v3 specification…
- essentials-openapiGenerates OpenAPI v2 and v3 documentation in JSON and YAML formats,…
- openapi-pydanticProvides Pydantic-based classes that implement the OpenAPI 3.1.1…
Give your agent the search over MCP, or paste the wish link into any chat.
More WWW/HTTP packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
h11 is a pure-Python HTTP/1.1 protocol implementation that handles parsing and serializing HTTP messages without any built-in I/O, letting you integrate it with any network layer you choose.
HTTPX is a fully featured HTTP client library for Python that provides both sync and async APIs, with support for HTTP/1.1 and HTTP/2, plus an integrated command-line client.
Install it if you are building new projects or modernizing existing ones that rely on HTTP.
A minimal low-level HTTP client library that sends HTTP requests with thread-safe and task-safe connection pooling, supporting HTTP/1.1, HTTP/2, proxies, and both sync and async interfaces.
aiohttp is an async HTTP client and server framework built on asyncio, supporting both WebSockets and middleware-based routing for building concurrent web applications.
Install it if you need async HTTP client or server capabilities in asyncio-based applications.
See also openapi-pydantic · flask-pydantic-spec · aiopenapi3 · flask-openapi3 · turnkey-sdk-types · open-data-contract-standard · openapi-spec-validator · json-schema-to-pydantic · openapi-python-client · schemathesis