AshTypescript.TypedController.Codegen.RouteRenderer (ash_typescript v0.19.0)

Copy Markdown View Source

Generates TypeScript functions for typed controller routes.

  • GET routes generate path helper functions.
  • Mutation routes (POST/PATCH/PUT/DELETE) generate typed action functions with input types derived from route arguments.
  • Routes declaring returns get an exported result type; their action functions resolve to a TypedControllerResponse typed by it. GET routes declaring returns also get a fetch function (see Codegen.fetch_function?/1).

Summary

Functions

Renders TypeScript code for a single route without Zod schema.

Renders the Valibot schema for a route's input.

Renders the Zod schema for a route's input.

Functions

render_no_zod(route_info, opts \\ [])

Renders TypeScript code for a single route without Zod schema.

Same as render/1 but skips Zod schema generation (for split-file mode where Zod schemas live in ash_zod.ts).

Options

  • :has_base_path - When true, prefixes all URL expressions with ${_basePath}

render_valibot_schema(route_info)

Renders the Valibot schema for a route's input.

Returns an empty string for routes without non-path arguments, or when Valibot schema generation is disabled.

render_zod_schema(route_info)

Renders the Zod schema for a route's input.

Returns an empty string for routes without non-path arguments, or when Zod schema generation is disabled.