Formats input data from client format to internal format.
This module handles the conversion of client-provided field names and values to the internal representation expected by Ash actions. It focuses specifically on action arguments and accepted attributes, then delegates to ValueFormatter for recursive type-aware formatting of nested values.
Key responsibilities:
- Convert client field names to internal atom keys (e.g., "userId" -> :user_id)
- Preserve untyped map keys exactly as received
- Handle nested structures within input data via ValueFormatter
- Work only with action arguments and accepted attributes (simplified scope)
Summary
Functions
Builds a map of expected client field names to internal Elixir field names.
Formats input data from client format to internal format.
Functions
Builds a map of expected client field names to internal Elixir field names.
This map is used to correctly parse incoming input data by looking up the exact client name that codegen would have generated, rather than blindly applying formatter transformations.
Parameters
resource: The Ash resource moduleaction: The action structformatter: The field formatter configuration
Returns
A map where keys are client field names (strings) and values are internal Elixir field names (atoms).
Example
%{
"userName" => :user_name,
"isActive" => :is_active?,
"addressLine1" => :address_line_1
}
Formats input data from client format to internal format.
Converts client field names to internal format while preserving untyped map keys. Only processes action arguments and accepted attributes - no relationships, calculations, or aggregates.
Parameters
data: The input data from the clientresource: The Ash resource moduleaction_name_or_action: The name of the action or the action struct itselfformatter: The field formatter to use for conversion
Returns
The formatted data with client field names converted to internal atom keys, except for untyped map keys which are preserved exactly.