LiveReactNative.FormSerializer (live_react_native v0.0.3)
View SourceSerializes any Phoenix.HTML.FormData assign (Ecto changeset via to_form/1,
AshPhoenix.Form, or a bare %Phoenix.HTML.Form{}) to a wire-safe shape the
mobile client renders: %{name, params, errors, valid}.
The wire key is valid (JSON-friendly for the JS client), not the
Elixir-idiomatic valid?. valid is nil until the form has an action set
(i.e. has been validated); after that it reflects whether there are errors.
Correctness still lives in the
app's submit handler, which always re-validates server-side.
Summary
Functions
True only for FormData structs (never plain maps, which implement FormData for params-forms).
Serialize a single form value to the wire shape.
Map every form assign to its serialized shape; leave non-form assigns untouched.
Types
Functions
True only for FormData structs (never plain maps, which implement FormData for params-forms).
@spec serialize(term()) :: serialized()
Serialize a single form value to the wire shape.
Map every form assign to its serialized shape; leave non-form assigns untouched.