Local read-only scanner for Zod/OpenAPI contract drift risks.
Project description
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 needadditionalPropertiesreview.z.union(...)without a nearby discriminator hint.z.transform(...),.refine(...),.superRefine(...)in public schemas.- Route handlers with auth hints but no visible
401/403response 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-severitysupports high-risk-only reports for CI summaries.--list-rulescan 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zod_openapi_contract_lint_kit-0.1.1.tar.gz.
File metadata
- Download URL: zod_openapi_contract_lint_kit-0.1.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e38021c53b47b2b4b7040864603567543f99cb9dc5b248b42c7078b98b7ce5b
|
|
| MD5 |
f5d7aefc0e2537f30db4ed58d8678e02
|
|
| BLAKE2b-256 |
c7d15c7fdccb750a50e9dc60c0a850e1b4c819ea612a8b32900ffc62fff7fd8a
|
Provenance
The following attestation bundles were made for zod_openapi_contract_lint_kit-0.1.1.tar.gz:
Publisher:
publish.yml on vasiliy0/zod-openapi-contract-lint-kit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zod_openapi_contract_lint_kit-0.1.1.tar.gz -
Subject digest:
6e38021c53b47b2b4b7040864603567543f99cb9dc5b248b42c7078b98b7ce5b - Sigstore transparency entry: 1553482711
- Sigstore integration time:
-
Permalink:
vasiliy0/zod-openapi-contract-lint-kit@14daa74b176bfb4b77bac902fd7e87a82b03d783 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vasiliy0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14daa74b176bfb4b77bac902fd7e87a82b03d783 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file zod_openapi_contract_lint_kit-0.1.1-py3-none-any.whl.
File metadata
- Download URL: zod_openapi_contract_lint_kit-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00546ca1fc2166827a0122e41d11e030295008a7bbec86c1f7371987eec344f4
|
|
| MD5 |
402dd49ed003e44670ee490ab7bb4f5e
|
|
| BLAKE2b-256 |
cbe95531832499a52b6c6c2b3eb5d8aef65fcd526dd4d3371076fbc60e5186c2
|
Provenance
The following attestation bundles were made for zod_openapi_contract_lint_kit-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on vasiliy0/zod-openapi-contract-lint-kit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zod_openapi_contract_lint_kit-0.1.1-py3-none-any.whl -
Subject digest:
00546ca1fc2166827a0122e41d11e030295008a7bbec86c1f7371987eec344f4 - Sigstore transparency entry: 1553482721
- Sigstore integration time:
-
Permalink:
vasiliy0/zod-openapi-contract-lint-kit@14daa74b176bfb4b77bac902fd7e87a82b03d783 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vasiliy0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14daa74b176bfb4b77bac902fd7e87a82b03d783 -
Trigger Event:
workflow_dispatch
-
Statement type: