Skip to main content

openapi-normalizer

PyPI Python License: MIT

Load, resolve, and normalise OpenAPI 3.x and Swagger 2.0 specifications into a single, version-agnostic data model.

  • 🔗 $ref resolution — resolves intra-document references with cycle protection
  • 📦 Version normalisation — OpenAPI 3.x and Swagger 2.0 become the same internal model
  • 🌐 HTTP + local files — load specs from URLs or filesystem paths
  • 📄 JSON + YAML — both formats supported
  • ✅ Typed, tested, and linted

Installation

pip install openapi-normalizer

Requires Python 3.10+.

Quickstart

from openapi_normalizer import load_spec, resolve_refs, parse_spec

# Load from URL or file (JSON or YAML)
document = load_spec("https://petstore3.swagger.io/api/v3/openapi.json")

# Resolve all intra-document $ref pointers
document = resolve_refs(document)

# Normalise into a version-agnostic model
spec = parse_spec(document)

print(spec.title)     # "Swagger Petstore - OpenAPI 3.0"
print(spec.base_url)  # "/api/v3"
for op in spec.operations:
    print(op.method, op.path, op.operation_id)

API

load_spec(ref, *, timeout=30.0) → dict

Load a spec from a URL or local file. Returns the parsed document as a dict.

resolve_refs(document) → dict

Resolve all local $ref pointers (e.g. #/components/schemas/Pet) in-place. External references are preserved. Cycles are broken safely.

detect_version(document) → str

Return "openapi-3" or "swagger-2".

parse_spec(document, *, source_ref=None, base_url_override=None) → ParsedSpec

Normalise a ref-resolved document into a ParsedSpec containing:

  • title, base_url, spec_version
  • operations — list of Operation (method, path, parameters, request body, tags)
  • security_schemes — dict of SecurityScheme (type, scheme, name, location)

License

MIT

Metadata

Release files for openapi-normalizer 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openapi-normalizer 0.1.0
File Size Uploaded Provenance
openapi_normalizer-0.1.0.tar.gz 10.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for openapi-normalizer 0.1.0
File Interpreter ABI Platform
openapi_normalizer-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / openapi_normalizer-0.1.0.tar.gz

Download URL openapi_normalizer-0.1.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
181d95b3cf59054d83097f2f5575a9f64f48f919ab88b5d6091ad02e2ef5f37f
BLAKE2b-256 checksum
How to use checksums
e144dfc2640996acc31787b4180e1a7ce7ae3cbf091fbc032faf454da7c9b092
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 31, 2026.

Transparency log

Release files / openapi_normalizer-0.1.0-py3-none-any.whl

Download URL openapi_normalizer-0.1.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4879124f62bbafb598dad0e2282928ecff2ce8e1b1cf5a1273cbad060a31142
BLAKE2b-256 checksum
How to use checksums
f7118be5d129940986160b202fa10d4a6fe370595c44241ba63970ca3206d303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 31, 2026.

Transparency log

Security for openapi-normalizer 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openapi_normalizer-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page