Convert OpenAPI schema JSON files to Zod schema definitions or TypeScript interfaces
Project description
dtolator
Code generator that converts OpenAPI schemas, plain JSON, and JSON Schema files into typed code for multiple languages and frameworks.
Supported outputs
| Flag | Output |
|---|---|
| (default) | Zod schemas (stdout) |
--typescript / -t |
TypeScript interfaces |
--zod / -z |
Zod schemas + TypeScript DTOs |
--angular / -a |
Angular API services |
--pydantic |
Python Pydantic models |
--python-dict |
Python TypedDict definitions |
--dotnet |
C# classes (System.Text.Json) |
--json-schema |
JSON Schema |
--endpoints / -e |
API endpoint types |
--rust-serde |
Rust structs with Serde |
Installation
Install with uv (recommended) — it fetches the prebuilt binary from PyPI and puts it on your PATH:
uv tool install dtolator
To upgrade later:
uv tool upgrade dtolator
Or download the latest executable from the GitHub Releases page and place it on your PATH.
Or install via Cargo:
cargo install --git https://github.com/vivainio/dtolator
Or build from source:
git clone https://github.com/vivainio/dtolator
cd dtolator
cargo build --release
Usage
# Zod schemas to stdout (default)
dtolator --from-openapi schema.json
# TypeScript interfaces to stdout
dtolator --from-openapi schema.json --typescript
# Write to directory (generates dto.ts + schema.ts)
dtolator --from-openapi schema.json --zod -o ./output
# Angular services with Zod validation and promises
dtolator --from-openapi schema.json -o ./src/app/api --angular --zod --promises
# From plain JSON (like quicktype)
dtolator --from-json data.json --typescript --root MyType
# From JSON Schema
dtolator --from-json-schema schema.json --pydantic
Input types
Exactly one required:
--from-openapi <FILE>— OpenAPI 3.x specification (richest: includes endpoints, params, validation)--from-json <FILE>— Plain JSON data (schema inferred automatically)--from-json-schema <FILE>— JSON Schema definition
Output options
-o, --output <DIR>— Write files to directory instead of stdout--delete-old— After generation, delete files in the output directory that weren't just generated--skip-file <NAME>— Skip writing a specific file (repeatable)--hide-version— Omit version from generated file headers--debug— Verbose debug output
Angular-specific options
--promises— UselastValueFrom/Promiseinstead ofObservable--base-url-mode <MODE>—global(default) orargument--api-url-variable <NAME>— Global variable name for API URL (default:API_URL)
See ANGULAR.md for detailed Angular integration docs.
OpenAPI features supported
- Basic types: string, number, integer, boolean, array, object
- Enums,
$refreferences, nullable/optional properties - Composition:
allOf,oneOf,anyOf - Validation: minLength, maxLength, minimum, maximum, pattern, format
- Paths: path params, query params, header params, request bodies, response types
- Map/dictionary types via
additionalProperties
Incremental writes
Files are only written when content actually changes (with a fast-path file-size check), so bundler watchers won't trigger unnecessary rebuilds.
Testing
cargo test # Run all tests
python run-tests.py # Integration test suite
python run-tests.py --refresh # Update expected outputs after intentional changes
See ADVANCED.md for endpoint generation details.
License
MIT
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 Distributions
Built Distributions
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 dtolator-0.24.1-py3-none-win_amd64.whl.
File metadata
- Download URL: dtolator-0.24.1-py3-none-win_amd64.whl
- Upload date:
- Size: 805.8 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c23dc3414b560b650a1f5b347162f0b25f50ac0b3ec655251a6976dc1bc7f35
|
|
| MD5 |
cf1f83f2f11255857b3843d737875a8e
|
|
| BLAKE2b-256 |
bbebaa1704e2edee2e094ece8bc98fa64570a438aac19730016fb5c5fb820b5c
|
Provenance
The following attestation bundles were made for dtolator-0.24.1-py3-none-win_amd64.whl:
Publisher:
ci.yml on vivainio/dtolator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dtolator-0.24.1-py3-none-win_amd64.whl -
Subject digest:
1c23dc3414b560b650a1f5b347162f0b25f50ac0b3ec655251a6976dc1bc7f35 - Sigstore transparency entry: 1849800023
- Sigstore integration time:
-
Permalink:
vivainio/dtolator@7ebf896425ac3122650d7ba0d65a5ca17a58c5ab -
Branch / Tag:
refs/tags/v0.24.1 - Owner: https://github.com/vivainio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7ebf896425ac3122650d7ba0d65a5ca17a58c5ab -
Trigger Event:
release
-
Statement type:
File details
Details for the file dtolator-0.24.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dtolator-0.24.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 968.5 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7f7893ba6d7e71799542e30206a221dd65aee2d37dcc7d0b70d90e1a0689e0e
|
|
| MD5 |
67a8748981b15628d7d9222d6130a14f
|
|
| BLAKE2b-256 |
d205b41ba482c79fc1758f0626fc2d65621bea5b7799da58855537531a38a91f
|
Provenance
The following attestation bundles were made for dtolator-0.24.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
ci.yml on vivainio/dtolator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dtolator-0.24.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
a7f7893ba6d7e71799542e30206a221dd65aee2d37dcc7d0b70d90e1a0689e0e - Sigstore transparency entry: 1849800407
- Sigstore integration time:
-
Permalink:
vivainio/dtolator@7ebf896425ac3122650d7ba0d65a5ca17a58c5ab -
Branch / Tag:
refs/tags/v0.24.1 - Owner: https://github.com/vivainio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7ebf896425ac3122650d7ba0d65a5ca17a58c5ab -
Trigger Event:
release
-
Statement type:
File details
Details for the file dtolator-0.24.1-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: dtolator-0.24.1-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 880.5 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb00dad85a6b4c1eaac31cbfbaa4bc16cf5185ac716169aeb4edb02840f9e788
|
|
| MD5 |
6cf9de5dbc41f4a6380c681d461e2949
|
|
| BLAKE2b-256 |
53651747de0a5d7c17f978facd0623f45539a37a25f299a413d41e0e996da8ae
|
Provenance
The following attestation bundles were made for dtolator-0.24.1-py3-none-macosx_11_0_arm64.whl:
Publisher:
ci.yml on vivainio/dtolator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dtolator-0.24.1-py3-none-macosx_11_0_arm64.whl -
Subject digest:
fb00dad85a6b4c1eaac31cbfbaa4bc16cf5185ac716169aeb4edb02840f9e788 - Sigstore transparency entry: 1849799944
- Sigstore integration time:
-
Permalink:
vivainio/dtolator@7ebf896425ac3122650d7ba0d65a5ca17a58c5ab -
Branch / Tag:
refs/tags/v0.24.1 - Owner: https://github.com/vivainio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7ebf896425ac3122650d7ba0d65a5ca17a58c5ab -
Trigger Event:
release
-
Statement type:
File details
Details for the file dtolator-0.24.1-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: dtolator-0.24.1-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 923.5 kB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abe52e789271768a92978338f8b2ae935a45c9de5c73f7bfc7f3fb541471e86a
|
|
| MD5 |
9da8dcfc83ac21132454ff2f87defce0
|
|
| BLAKE2b-256 |
4e24fd549144278d699f2fdfbb56ee6b470baccb32238f5c94cf87ccc6cdc969
|
Provenance
The following attestation bundles were made for dtolator-0.24.1-py3-none-macosx_10_12_x86_64.whl:
Publisher:
ci.yml on vivainio/dtolator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dtolator-0.24.1-py3-none-macosx_10_12_x86_64.whl -
Subject digest:
abe52e789271768a92978338f8b2ae935a45c9de5c73f7bfc7f3fb541471e86a - Sigstore transparency entry: 1849800155
- Sigstore integration time:
-
Permalink:
vivainio/dtolator@7ebf896425ac3122650d7ba0d65a5ca17a58c5ab -
Branch / Tag:
refs/tags/v0.24.1 - Owner: https://github.com/vivainio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7ebf896425ac3122650d7ba0d65a5ca17a58c5ab -
Trigger Event:
release
-
Statement type: