AshTypescript.Codegen.ZodSchemaGenerator (ash_typescript v0.17.3)

Copy Markdown View Source

Generates Zod validation schemas for Ash resources and actions.

This module is a thin formatter adapter over AshTypescript.Codegen.SchemaCore. It implements AshTypescript.Codegen.SchemaFormatter with Zod-specific output syntax (method chaining, z.enum, .optional(), etc.).

Summary

Functions

Generates a Zod schema definition for an RPC action's input.

Generates a Zod schema for a single resource.

Generates Zod schemas for embedded resources and struct arguments.

Maps Ash type structs (attribute/argument maps) to a Zod schema string.

Functions

generate_zod_schema(resource, action, rpc_action_name)

Generates a Zod schema definition for an RPC action's input.

generate_zod_schema_for_resource(resource)

Generates a Zod schema for a single resource.

generate_zod_schemas_for_resources(resources)

Generates Zod schemas for embedded resources and struct arguments.

get_zod_type(type_and_constraints, context \\ nil)

Maps Ash type structs (attribute/argument maps) to a Zod schema string.