Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

dtolator

image image CI

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 --zod dto.ts/schema.ts pair) require --output <DIR>; --angular --output-file is rejected.
  • --delete-old — After generation, delete regular files directly in the output directory that weren't generated or skipped in this run. Subdirectories are left untouched.
  • --skip-file <NAME> — Skip writing a specific file (repeatable)
  • --hide-version — Omit version from generated file headers
  • --debug — Verbose debug output
  • --ts-enum-style <STYLE> — How named enum schemas are emitted in TypeScript/Zod output: union (default, "a" | "b"), const (as const object plus a same-named type), or enum (TypeScript enum). With Zod, the schema becomes z.enum(Name). Nullable enums and enums defined inline on a property stay unions

Angular-specific options

  • --promises — Use lastValueFrom / Promise instead of Observable
  • --base-url-mode <MODE> — global (default), argument, or none (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 operation summary, ignoring operationId

See ANGULAR.md for detailed Angular integration docs.

OpenAPI features supported

  • Basic types: string, number, integer, boolean, array, object
  • Enums, $ref references, 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

Metadata

Release files for dtolator 0.30.0rc1

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

Built distributions (wheels)

Table of built distributions (wheels) for dtolator 0.30.0rc1
File Actions
dtolator-0.30.0rc1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for dtolator-0.30.0rc1-py3-none-win_amd64.whl
dtolator-0.30.0rc1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for dtolator-0.30.0rc1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
dtolator-0.30.0rc1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for dtolator-0.30.0rc1-py3-none-macosx_11_0_arm64.whl
dtolator-0.30.0rc1-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for dtolator-0.30.0rc1-py3-none-macosx_10_12_x86_64.whl

Total release size: 3.7 MB

Release files / dtolator-0.30.0rc1-py3-none-win_amd64.whl

Download URL dtolator-0.30.0rc1-py3-none-win_amd64.whl
Size 841.3 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
70d9f2ea7295fafc49e83040ea6d9ffe0ce230b1eca4cec8cc76635133e38187
BLAKE2b-256 checksum
How to use checksums
d4ecec1929509ab4c279b56d53f29187f03ae66236ca65ab098c72b1d087a01f
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 Oct 5, 2026.

Transparency log

Release files / dtolator-0.30.0rc1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL dtolator-0.30.0rc1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 996.2 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
585f1408b7bb4e086497b0e45933f4ed9b0410f90903af0fea3a88d59b049849
BLAKE2b-256 checksum
How to use checksums
7023e6a7b19f64c9168f0560b6e19a390c17fe1f8bf1ab4065f288de2178b529
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 Oct 5, 2026.

Transparency log

Release files / dtolator-0.30.0rc1-py3-none-macosx_11_0_arm64.whl

Download URL dtolator-0.30.0rc1-py3-none-macosx_11_0_arm64.whl
Size 905.3 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fd50419cf6101a40fd80b643cb3b11dc3c750aa657edf187fb86a9fc7e503d83
BLAKE2b-256 checksum
How to use checksums
01e164f5b83810d561e5261f7c9d3deb218e9aa91f54fb67037986a2fafb0201
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 Oct 5, 2026.

Transparency log

Release files / dtolator-0.30.0rc1-py3-none-macosx_10_12_x86_64.whl

Download URL dtolator-0.30.0rc1-py3-none-macosx_10_12_x86_64.whl
Size 953.2 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
17d0e6851adbab3b7203ed36791013653714841526a6d6688ac54e02286cc310
BLAKE2b-256 checksum
How to use checksums
f07130398e7811269e96c869bbaec40e85a11e0ef361c16777a55e47e00bfaf7
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 Oct 5, 2026.

Transparency log

Security for dtolator 0.30.0rc1

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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for dtolator-0.30.0rc1-py3-none-win_amd64.whl

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 Oct 5, 2026.

Transparency log

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.

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