AshTypescript.Rpc.InputFormatter (ash_typescript v0.18.0)

Copy Markdown View Source

Formats input data from client format to internal format.

Converts client-provided field names and values to the internal representation expected by Ash actions. Delegates to ValueFormatter for recursive type-aware formatting of nested values using %Ash.Info.Manifest.Type{} structs.

Summary

Functions

Returns the %{client_name => internal_name} map for an action under the configured output formatter. Reads the value precomputed onto the action's custom.ash_typescript (keyed per built-in formatter) when present, and falls back to a live computation for undecorated actions or custom formatters.

Pure computation of the expected-keys map for a given formatter (defaults to the configured output formatter). Walks action.inputs (unified arguments + accepted attributes) once, deriving each input's client-facing name via ActionIntrospection.format_input_name/5 so runtime parsing and codegen agree. Used by the manifest decorator (to precompute per built-in formatter) and as the runtime fallback.

Functions

build_expected_keys_map(resource, action, input_formatter, resource_lookups \\ nil)

Returns the %{client_name => internal_name} map for an action under the configured output formatter. Reads the value precomputed onto the action's custom.ash_typescript (keyed per built-in formatter) when present, and falls back to a live computation for undecorated actions or custom formatters.

Client names depend on the output formatter, which is runtime-configurable, so the cache is keyed by formatter (mirroring formatted_field_names).

compute_expected_keys_map(resource, action, resource_lookups \\ nil, formatter \\ nil)

Pure computation of the expected-keys map for a given formatter (defaults to the configured output formatter). Walks action.inputs (unified arguments + accepted attributes) once, deriving each input's client-facing name via ActionIntrospection.format_input_name/5 so runtime parsing and codegen agree. Used by the manifest decorator (to precompute per built-in formatter) and as the runtime fallback.

format(data, resource, action_name_or_action, formatter, resource_lookups \\ nil, type_index \\ %{})

Formats input data from client format to internal format.