Skip to main content

Crate prax_typegen

Crate prax_typegen 

Source
Expand description

§prax-typegen

Generate TypeScript interfaces and Zod schemas from Prax ORM schema files.

This crate reads .prax schema files and produces TypeScript output that mirrors the models, enums, and composite types defined in the schema.

§Generator Block

Add a generator block to your .prax schema:

generator typescript {
  provider = "prax-typegen"
  output   = "./src/types"
  generate = env("TYPESCRIPT_GENERATE")
}

When TYPESCRIPT_GENERATE is set to true, 1, or yes in the environment, prax generate will invoke this generator.

Structs§

GeneratedOutput
Generated TypeScript output.
InterfaceGenerator
Generates TypeScript interfaces from a Prax schema.
TypeMapper
Maps Prax types to TypeScript / Zod representations.
Typegen
Top-level generator that produces both interfaces and Zod schemas.
ZodGenerator
Generates Zod schemas from a Prax schema.

Enums§

TypegenError

Functions§

generator_enabled
Check the schema for a generator named name and return whether it’s enabled.
resolve_output_dir
Resolve the output directory from the generator block, falling back to a default.

Type Aliases§

Result
Result type for typegen operations.