Skip to main content

Module zod_ts

Module zod_ts 

Source
Expand description

Code generation for #[derive(ZodTs)].

Generates a fn zod_ts() -> String method that returns a complete TypeScript block with a Zod schema and a z.infer type alias, plus an inventory::submit! for SchemaRegistration.

Functions§

base_type_name
Extract the base type name, stripping all wrappers.
derive_zod_ts
Generate the #[derive(ZodTs)] expansion.
rust_type_to_ts_schema
Convert a Rust type name string to a TypeScript Zod schema reference.
rust_type_to_zod
Map a syn::Type to a Zod schema expression string.
to_schema_name
Convert type name to schema constant name: "Planet""PlanetSchema"