openapi-core
client-side and server-side support for the OpenAPI Specification v3
What it is and what it does
openapi-core is a Python library that validates and unmarshals HTTP request and response data against OpenAPI v3.0, v3.1, and v3.2 specifications. It extracts and type-converts parameters, headers, cookies, and request bodies according to the schema, raising an error if the data does not conform. The library works both client-side (validating responses from external APIs) and server-side (validating incoming requests), and includes built-in integrations with Requests, Werkzeug, Django, Flask, FastAPI, Starlette, Falcon, and AIOHTTP.
The package depends on jsonschema, openapi-schema-validator, and openapi-spec-validator to perform the actual validation logic. It is actively maintained, supports modern Python versions, and carries no known security vulnerabilities. Installation is straightforward via pip with low friction.
Use it for:
- Validate incoming API requests against an OpenAPI spec in a Flask or Django view to reject malformed data early.
- Unmarshal and type-convert query parameters and path variables from a FastAPI or Starlette middleware layer.
- Verify that responses from a third-party API conform to its published OpenAPI specification before processing.
- Extract and validate security credentials (API keys, Bearer tokens, Basic auth) from requests according to the spec.
- Build an API gateway or proxy that enforces OpenAPI compliance on both inbound and outbound traffic.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Validates and unmarshals OpenAPI v3.0, v3.1, and v3.2 request and response data against a specification, with built-in support for popular frameworks like Django, Flask, FastAPI, and Starlette.
Yes. openapi-core is well-maintained, has no known vulnerabilities, and offers low install friction. It is the right choice if you need to validate or unmarshal OpenAPI v3.x data in a Python application, especially if you are already using one of its supported frameworks. The permissive BSD-3-Clause license poses no restrictions.
Install
openapi-core on PyPI
pip
pip install openapi-coreuv
uv add openapi-corepoetry
poetry add openapi-coreInstalling openapi-core
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained with a recent release and no known vulnerabilities. Supports current Python versions (3.10–3.14).
License in practice
BSD-3-Clause is permissive; you may use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
from openapi_core import OpenAPI
openapi = OpenAPI.from_file_path('openapi.json')
result = openapi.unmarshal_request(request)
path_params = result.parameters.path
query_params = result.parameters.query
body = result.body
Requires a request object that implements the OpenAPI Request protocol; for frameworks like Django, Flask, or Starlette, use the corresponding integration adapter.
Verify before relying
- Whether the package handles OpenAPI v2.0 (Swagger) specifications, or only v3.x versions as stated in the description.
- Performance characteristics when validating large or deeply nested OpenAPI specifications.
- Whether custom deserializers and unmarshallers are easy to implement for non-standard media types.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (<4.0.0,>=3.10.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — isodate, jsonschema, jsonschema-path, more-itertools, openapi-schema-validator, openapi-spec-validator, typing-extensions, werkzeug |
| Maintenance | actively maintained — 134 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,272,937/month — #2,344 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: openapi_core-0.23.1-py3-none-any.whl
Keywords: openapi, swagger, schema
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
openapi-schema-validatorValidates data and schemas against OpenAPI…
permissive · top 1,000 on PyPI
openapi-spec-validatorValidates OpenAPI specifications (versions 2.0,…
permissive · top 1,000 on PyPI
aiopenapi3Parses and validates OpenAPI 3 specifications…
permissive · top 15,000 on PyPI
bravado-corebravado-core validates, marshals, and…
permissive · top 15,000 on PyPI
spectreeGenerates OpenAPI documents and validates HTTP…
permissive · top 15,000 on PyPI
swagger-spec-validatorValidates Swagger/OpenAPI specifications…
permissive · top 15,000 on PyPI
prancePrance parses and validates Swagger/OpenAPI 2.0…
unclear · top 5,000 on PyPI
openapi3Parses and validates OpenAPI 3 specifications,…
permissive · top 15,000 on PyPI
apispecGenerates OpenAPI specification documents from…
permissive · top 5,000 on PyPI
coreapiA Python client library for interacting with…
permissive · top 5,000 on PyPI