Transpiles Ash resource constraints to rx() expressions for client-side validation.
This allows form validation to be driven from a single source of truth (the Ash resource) while still providing instant client-side feedback.
Supported constraints:
- String: min_length, max_length, match (regex)
- Integer: min, max
- All types: allow_nil? (required fields)
Summary
Functions
Generates an rx() expression AST for a field's validity check.
Returns all error checks with their messages for a validation.
Returns the error message for a constraint type.
Generates validation info for all attributes of a resource that have transpilable constraints.
Checks if an attribute has any constraints we can transpile to JS.
Functions
Generates an rx() expression AST for a field's validity check.
The expression references @<params_field>["<field_name>"] for the value.
Returns all error checks with their messages for a validation.
Each check is a tuple of {check_type, constraint_value, error_message}. Used to generate error list calculations.
Returns the error message for a constraint type.
Generates validation info for all attributes of a resource that have transpilable constraints.
Returns a list of field validation specs that can be used to generate calculate declarations.
Checks if an attribute has any constraints we can transpile to JS.