$npx skillfedfor your agent

openapi-pydantic

Pydantic OpenAPI schema implementation

With conditionsPyPI Released Jan 202567.1M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — openapi_pydantic-0.5.1-py3-none-any.whl
v0.5.1 · released 2025-01-08 · Python <4.0,>=3.8 · 1 runtime deps: pydantic

Yes, if you need to work with OpenAPI specs programmatically in Python. The package has low install friction, permissive licensing, and no known vulnerabilities. Maintenance is aging (last release 583 days ago), so monitor the repository for updates, but the code is stable and the dependency footprint is minimal. Suitable for production use in tools that generate or validate OpenAPI documents.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Pydantic 1.8+ or 2.x; when using Pydantic 1.x, replace model_dump_json() with json() and model_validate() with parse_obj().
  • Low install friction with a single runtime dependency on pydantic.
  • Maintenance is aging—last release was 583 days ago—but the repository remains active and unarchived with recent commits.

License · maintenance · safety

MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open and proprietary projects with minimal obligations.

last release 2025-01-08 (583 days) · last repo commit 2025-11-24 · 122 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 67,133,231 downloads/mo, #482 on PyPI

Verify before relying

pip install openapi-pydantic

from openapi_pydantic import OpenAPI, Info, PathItem, Operation, Response

open_api = OpenAPI(
    info=Info(title="My API", version="v1.0.0"),
    paths={"/ping": PathItem(get=Operation(responses={"200": Response(description="pong")}))}
)
print(open_api.model_dump_json(by_alias=True, exclude_none=True, indent=2))
  • Whether the package handles all OpenAPI 3.0 and 3.1 specification features or has known gaps in schema coverage.
  • Performance characteristics when working with large or deeply nested OpenAPI documents.
Same gist for agents: .md · .json

What it is and what it does

openapi-pydantic wraps the OpenAPI specification in Pydantic data classes, letting you build and validate OpenAPI schemas as Python objects instead of raw JSON or YAML. It supports both Pydantic 1.8+ and 2.x, following the official OpenAPI 3.1.1 schema naming conventions. You can construct specs programmatically by instantiating classes like OpenAPI, PathItem, Operation, and Response, or parse existing OpenAPI dicts into validated objects. The package also provides utilities to embed Pydantic model schemas directly into OpenAPI documents, automatically resolving JSON schema references.

The main use case is programmatic OpenAPI spec generation—useful when you want to build or modify API documentation in code rather than hand-writing YAML, or when you need runtime validation of OpenAPI structures. It integrates cleanly with Pydantic's serialization methods (model_dump_json, model_dump) and supports mixing object and dict inputs during construction.

Use it for

  • Generate OpenAPI specifications programmatically from Python code instead of writing static YAML files.
  • Validate OpenAPI documents at runtime to ensure they conform to the OpenAPI 3.1.1 schema.
  • Embed Pydantic model schemas into OpenAPI specs and automatically resolve JSON schema references.
  • Parse and modify existing OpenAPI dicts while maintaining type safety and spec compliance.
  • Build API documentation generators that construct OpenAPI specs from application code.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need to work with OpenAPI specs programmatically in Python.

The package has low install friction, permissive licensing, and no known vulnerabilities. Maintenance is aging (last release 583 days ago), so monitor the repository for updates, but the code is stable and the dependency footprint is minimal. Suitable for production use in tools that generate or validate OpenAPI documents.

Install

openapi-pydantic on PyPI

Before you install

Low install friction with a single runtime dependency on pydantic. Maintenance is aging—last release was 583 days ago—but the repository remains active and unarchived with recent commits.

Requires Pydantic 1.8+ or 2.x; when using Pydantic 1.x, replace model_dump_json() with json() and model_validate() with parse_obj().

License in practice

MIT license permits unrestricted use, modification, and distribution in both open and proprietary projects with minimal obligations.

Quickstart

pip install openapi-pydantic

from openapi_pydantic import OpenAPI, Info, PathItem, Operation, Response

open_api = OpenAPI(
    info=Info(title="My API", version="v1.0.0"),
    paths={"/ping": PathItem(get=Operation(responses={"200": Response(description="pong")}))}
)
print(open_api.model_dump_json(by_alias=True, exclude_none=True, indent=2))

Verify before relying

  • Whether the package handles all OpenAPI 3.0 and 3.1 specification features or has known gaps in schema coverage.
  • Performance characteristics when working with large or deeply nested OpenAPI documents.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release <4.0,>=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
pydantic
MaintenanceAging 583 days since the last release
Last repo commit
First released
Downloads67,133,231 / month, #482 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Framework :: PydanticLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Evidence: openapi_pydantic-0.5.1-py3-none-any.whl

Tags

Capabilities
openapi schema pydanticopenapi validation pythonbuild openapi spec programmaticallyopenapi 3.1 pydantic modelsopenapi schema serializationpydantic openapi classesopenapi spec generator
Topics
openapischema-validationapi-documentation
PyPI keywords
openapischemaparserpydanticvalidation

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 › “build openapi spec programmatically”

  • openapi-pydanticProvides Pydantic-based classes that implement the OpenAPI 3.1.1…
  • openapi-spec-validatorValidates OpenAPI specifications (versions 2.0, 3.0, 3.1, and 3.2)…
  • tapipyTapipy is a Python SDK that automatically generates client bindings…

Give your agent the search over MCP, or paste the wish link into any chat.

Similar packages

openapi-schema-pydantic With conditions
PyPI · WWW/HTTP · released Jun 2022

Provides Pydantic classes that map to the OpenAPI v3 specification schema, enabling programmatic construction and validation of OpenAPI documents.

Install it if you need to work with OpenAPI specs in Python and can tolerate slow or no updates.

MITpure Python · 3.6.1+dormant
1.1Mdownloads / mo
flask-pydantic-spec With conditions
PyPI · Python Modules · released Nov 2025

Adds OpenAPI documentation generation and request/response validation to Flask applications using Pydantic models and Python annotations.

license unclearpure Python · 3.9+aging
77.3Kdownloads / mo
flask-openapi3 Worth it
PyPI · Dynamic Content · released May 2026

Builds REST APIs on Flask with automatic OpenAPI documentation and Pydantic-based request/response validation.

MITpure Python · 3.10+
609.6Kdownloads / mo
openresponses-types With conditions
PyPI · Artificial Intelligence · released Aug 2026

Provides Pydantic models for the OpenResponses API specification, enabling type-safe interaction with OpenResponses services in Python.

Apache-2.0pure Python · 3.11+
136.1Kdownloads / mo
stac-pydantic Worth it
PyPI · Information Analysis · released Jun 2026

Provides Pydantic models for validating and serializing STAC (Spatiotemporal Asset Catalog) Catalogs, Collections, Items, and STAC API specifications, enabling type-safe request/response handling in web frameworks.

Install it if you are building or consuming STAC APIs or need to validate geospatial catalog metadata.

MITpure Python · 3.10+
151.5Kdownloads / mo
openapi-python-client Worth it
PyPI · Code Generators · released May 2026

Generates type-annotated Python HTTP clients from OpenAPI 3.0 and 3.1 specifications, producing ready-to-use client libraries with models, API functions, and authentication support.

MITpure Python
3.5Mdownloads / mo

See also json-schema-to-pydantic · openapi-schema-validator · openapi-spec-validator · django-pydantic-field