Skip to main content

Zod OpenAPI Contract Lint Kit

Local read-only prototype for finding common drift risks between Zod schemas, OpenAPI metadata, route responses, and generated API clients.

Why this exists

Teams often start with Zod as runtime validation and later generate OpenAPI specs/clients. Drift appears when schemas use constructs generators cannot represent cleanly, when route metadata is missing, or when auth/error responses are inconsistent.

This prototype scans TypeScript files and reports review items. It does not execute application code, import project modules, call network APIs, or modify files.

Current v1 checks

  • Zod object schemas exported without nearby OpenAPI metadata (.openapi(...) or .describe(...)).
  • z.any() / z.unknown() in public contracts.
  • z.date() fields that may serialize differently in OpenAPI/client transports.
  • z.record(...) map types that may need additionalProperties review.
  • z.union(...) without a nearby discriminator hint.
  • z.transform(...), .refine(...), .superRefine(...) in public schemas.
  • Route handlers with auth hints but no visible 401 / 403 response docs nearby.
  • Error responses without an obvious schema/envelope reference.

Try locally

python3 scanner.py examples
python3 scanner.py examples --format json
python3 scanner.py examples --output report.md
python3 scanner.py examples --fail-on-severity high
python3 scanner.py examples --min-severity high
python3 scanner.py examples --only-rule zod-date-serialization-review
python3 scanner.py --list-rules
python3 scanner.py --list-rules --format json
python3 scanner.py examples --ignore-rule runtime-only-zod-effect

CI usage

See docs/CI_USAGE.md for report-only, high-risk-only, and scoped rollout examples.

Safety

  • Read-only local scan.
  • No GitHub/npm/OpenAPI service account required.
  • No dependency installation required for the prototype.
  • Findings are review prompts, not automatic migration claims.
  • CI failure is opt-in via --fail-on-severity.
  • Rule filtering is explicit and local; unknown rule ids fail fast instead of silently changing coverage.
  • --min-severity supports high-risk-only reports for CI summaries.
  • --list-rules can be used to review active rule coverage before adding the scanner to CI.

Roadmap

  • Expand fixtures across common Zod/OpenAPI routing patterns.
  • Add fixtures for hono/zod-openapi/express-zod-api route variants.
  • Package as a small developer CLI after the prototype stabilizes.
  • Add more routing-library examples and release notes.

Metadata

Release files for zod-openapi-contract-lint-kit 0.1.1

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

Source distribution (sdist)

Source distribution for zod-openapi-contract-lint-kit 0.1.1
File Size Uploaded
zod_openapi_contract_lint_kit-0.1.1.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zod-openapi-contract-lint-kit 0.1.1
File Interpreter ABI Platform
zod_openapi_contract_lint_kit-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / zod_openapi_contract_lint_kit-0.1.1.tar.gz

Download URL zod_openapi_contract_lint_kit-0.1.1.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6e38021c53b47b2b4b7040864603567543f99cb9dc5b248b42c7078b98b7ce5b
BLAKE2b-256 checksum
How to use checksums
c7d15c7fdccb750a50e9dc60c0a850e1b4c819ea612a8b32900ffc62fff7fd8a
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 16, 2026.

Transparency log

Release files / zod_openapi_contract_lint_kit-0.1.1-py3-none-any.whl

Download URL zod_openapi_contract_lint_kit-0.1.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00546ca1fc2166827a0122e41d11e030295008a7bbec86c1f7371987eec344f4
BLAKE2b-256 checksum
How to use checksums
cbe95531832499a52b6c6c2b3eb5d8aef65fcd526dd4d3371076fbc60e5186c2
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 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

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