AshTypescript. TypedController. Transformers. FoldArgumentConstraints
(ash_typescript v0.19.0)
Copy Markdown
View Source
Validates and folds each route argument's constraints against the argument type's constraint schema, exactly like Ash does for resource attributes and action arguments.
This normalizes route arguments to the same shape as manifest inputs at the
source, by validating and then running Ash.Type.init/2 as Ash does for
action arguments: type constraint defaults (e.g. allow_empty?: false, trim?: true for strings) are made explicit and a NewType's own constraints
are merged in, so every downstream consumer — the request
handler's constraint application, TS type mapping, and the shared Zod/
Valibot field composition in SchemaCore — sees identical data regardless
of whether a field originated from an RPC action or a typed controller.
A route's returns constraints are folded the same way, so result type
generation sees the same normalized shape as a generic action's returns.
The returns type is also restricted to plain data (no resources or unions,
at any depth), since the handler — not the caller — decides what it sends.
Invalid constraints (typos, wrong option types) and types that aren't Ash types become compile-time errors, matching Ash's behavior for resource arguments.
Summary
Functions
Callback implementation for Spark.Dsl.Transformer.after?/1.
Callback implementation for Spark.Dsl.Transformer.after_compile?/0.
Functions
Callback implementation for Spark.Dsl.Transformer.after?/1.
Callback implementation for Spark.Dsl.Transformer.after_compile?/0.