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
For the complete flag reference, see docs/cli.md (generated from
the CLI definition; run DTOLATOR_TEST_REFRESH=1 cargo test to regenerate).
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--output-file <FILE>— Write the combined output to a single file (mutually exclusive with--output). Parent directories are created as needed. Multi-file generators (--angular, and the--zoddto.ts/schema.ts pair) require--output <DIR>;--angular --output-fileis rejected.--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),argument, ornone(relative URLs, route only)--api-url-variable <NAME>— Global variable name for API URL (default:API_URL)--ignore-operation-id— Derive method names from the operationsummary, ignoringoperationId
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
Release files for dtolator 0.26.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| dtolator-0.26.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| dtolator-0.26.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| dtolator-0.26.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| dtolator-0.26.0-py3-none-macosx_10_12_x86_64.whl | Python 3 | none | macOS 10.12+ x86-64 | Details |
Total release size: 3.5 MB
Release files / dtolator-0.26.0-py3-none-win_amd64.whl
| Download URL | dtolator-0.26.0-py3-none-win_amd64.whl |
|---|---|
| Size | 800.5 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a68966c467542e09887fa4a88648972f4f4921b33b16ae19972fe1ecc9e0338b
|
|
BLAKE2b-256 checksum How to use checksums |
54380dac6d2a101c1fed408ad0a098d0aacb215fbebd98ab268dae39fbf3a220
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 21, 2026.
Transparency logRelease files / dtolator-0.26.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | dtolator-0.26.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 956.0 kB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
af4dbd363754bf9deb52e691b9b9839761adc9d5dbd65165d3664585bf74d38a
|
|
BLAKE2b-256 checksum How to use checksums |
1116f48f18b0c0e4e4e837f9a9974d7c00ca8981fb4e50abe106e462f1e6b93f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 21, 2026.
Transparency logRelease files / dtolator-0.26.0-py3-none-macosx_11_0_arm64.whl
| Download URL | dtolator-0.26.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 872.8 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
380d837a0d55f8004d46b1468a35ce983f4841117f9f016d74e2339be9a11848
|
|
BLAKE2b-256 checksum How to use checksums |
9dc9ae0ac50f61983e2b5bb5cd39522ccc47d06097e113de22170b5b54989a2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 21, 2026.
Transparency logRelease files / dtolator-0.26.0-py3-none-macosx_10_12_x86_64.whl
| Download URL | dtolator-0.26.0-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 911.5 kB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
b431f63d7aee59e8509e0e4472a791e067538093ce9903cba1639bcfa0218175
|
|
BLAKE2b-256 checksum How to use checksums |
dc34a2e6a4559bbbb6b6129b0056969fb026664a4fa95db26149bece3c6619ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 21, 2026.
Transparency log