ziipinParser
A fork of openapi3-parser,
published under a separate distribution name. Original attribution is retained
in license.txt.
Parse OpenAPI and Swagger documents into fully typed Pydantic models. Navigate your API specification programmatically — servers, paths, operations, parameters, schemas, security schemes, and more.
| Version | Status |
|---|---|
| 2.0 | Supported* |
| 3.0 | Supported |
| 3.1 | Supported |
| 3.2 | Supported |
* Swagger 2.0 documents are normalized to OpenAPI 3.0.
Installation
pip install ziipinParser
The Python import name is ziipinParser, matching the distribution name.
Publishing
Build the distributions for the version in pyproject.toml:
uv build --out-dir dist/ziipinparser
Configure your PyPI API token locally using UV_PUBLISH_TOKEN, or configure
PyPI Trusted Publishing for your own GitHub repository. Then upload the new
distribution artifacts:
uv publish dist/ziipinparser/*
Use the dist/ziipinparser/ directory when publishing. Artifacts built under
previous distribution names still contain those names in their metadata and
must not be included in the upload.
Before building a later release, update the version and empty the output directory so it contains only the artifacts you intend to publish.
Quick Start
from ziipinParser import parse
specification = parse("swagger.yml")
print(specification.info.title) # e.g. "User example service"
Use Cases
Parse from different sources
# From file path
spec = parse("specs/openapi.yml")
# From URL
spec = parse("https://example.com/openapi.json")
# From raw string
spec = parse(spec_string="""
openapi: "3.0.0"
info:
title: My API
version: "1.0.0"
paths: {}
""")
# From raw string with external $refs (resolved relative to base_uri)
spec = parse(
spec_string=open("specs/openapi.yml").read(),
base_uri="file:///abs/path/specs/openapi.yml",
)
Navigate servers, paths, and operations
specification = parse("swagger.yml")
# List all servers
for server in specification.servers:
print(f"{server.description} - {server.url}")
# Iterate paths and their HTTP methods
for path, path_item in specification.paths.items():
methods = ", ".join(
method for method in ("get", "put", "post", "delete", "patch")
if getattr(path_item, method) is not None
)
print(f"{path}: [{methods}]")
# Inspect operation details
for path_item in specification.paths.values():
get_op = path_item.get
if get_op is None:
continue
print(f"[GET] {path}: {get_op.summary}")
if get_op.deprecated:
print(" (deprecated)")
if get_op.operation_id:
print(f" operationId: {get_op.operation_id}")
Follow $ref references
$ref entries are resolved in place and annotated with a ref_name
pointing back to their canonical location:
schema = specification.components.schemas["Pet"]
print(schema.ref_name) # "#/components/schemas/Pet"
In OpenAPI 3.1+, siblings of $ref (such as default) are preserved.
References with local siblings produce separate models so they do not change
the shared component or other references to it.
Inspect schema defaults
JSON null is represented by Python None. Use has_default to distinguish
an explicit default: null from an omitted default:
if schema.has_default:
print(schema.default) # May be None for an explicit default: null
else:
print("No default declared")
has_default is included when printing the parsed specification or schemas,
and in model_dump() / model_dump_json() output, including nested schemas.
Error Handling
from ziipinParser.errors import ParserError
try:
spec = parse("invalid.yml")
except ParserError as e:
print(f"Parsing failed: {e}")
for detail in e.errors():
print(detail["loc"], detail["msg"])
Data Model
Parsed documents return a Specification object composed of fully typed
Pydantic models:
| Model | Description |
|---|---|
Specification |
Root document — openapi, info, servers, paths, components, security |
Info |
API metadata — title, version, description, contact, license |
Server |
Server definition — url, description, variables |
PathItem |
URL path — get/post/put/delete/patch, parameters, servers |
Operation |
HTTP method — responses, parameters, request body, security |
Parameter |
Path/query/header/cookie param — schema, style, required |
Response |
Status code, description, content, headers |
RequestBody |
Content, description, required |
MediaType |
Media type — schema, example, encoding |
Schema |
Data definition — type, properties, items, composition |
Components |
Reusable schemas, responses, parameters, examples, headers, ... |
SecurityScheme |
Security scheme — apiKey, http, oauth2, openIdConnect, mutualTLS |
OAuthFlow |
OAuth flow — authorization, token, scopes |
Header |
Response header — name, schema, description |
Link |
Link definition — operation, parameters, request body |
Example |
Example — value, summary, externalValue |
Tag |
Tag with optional external docs |
ExternalDoc |
External documentation reference |
Discriminator |
Polymorphism discriminator — property name, mapping |
See the models package for all available fields and types.
Development
# Install with dev dependencies
uv sync --dev
# Lint
uv run ruff check src/ tests/
uv run mypy src/ tests/
uv run ty check
# Test
uv run pytest
# Format
uv run ruff format src/ tests/
Metadata
Release files for ziipinParser 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ziipinparser-2.0.1.tar.gz | 15.4 kB | Without provenance | Details for ziipinparser-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ziipinparser-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for ziipinparser-2.0.1-py3-none-any.whl |
Total release size: 35.0 kB
Release files / ziipinparser-2.0.1.tar.gz
| Download URL | ziipinparser-2.0.1.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0583de0c041171ab2741f7c2dad6a88dfa412b327a7c74c04639c8e88067a580
|
|
BLAKE2b-256 checksum How to use checksums |
1bc237a9e83c156fdc2f6e29b6dbd4baa450f74b8f42a9003938ee868a24835c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / ziipinparser-2.0.1-py3-none-any.whl
| Download URL | ziipinparser-2.0.1-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a0bbb1e1ddbe535df070bc1c9273c03ead08637b845cd9c4d64ea3b1bd0758c
|
|
BLAKE2b-256 checksum How to use checksums |
8f401d6507d02599f18be72a718b53fd7b131df19d1f63f51669930e73a756fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for ziipinParser 2.0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.