bynk.types.form_uncodable
Error Form.decode or Form.encode names a type that is not a record of form fields (a String, Int, Bool, Decimal, an enum, or a refined or opaque type over one, optionally in an Option or a List).
Form.decode[T] and Form.encode read and write the flat key=value text a @form route handles, so T must be a record of fields a form can carry: a String, Int, Bool, Decimal, an enum, or a refined or opaque type over one, optionally in an Option or a List. Form keys have no nesting, so a nested record, or a type that is not a record, is refused. Put the nested record's fields in T itself. A @form route's own body has the same rule: bynk.http.form_field_not_stringy.
Example
type Address = { city: String }type Signup = { email: String, address: Address }
Form.decode[Signup](text) // ✗ `address` is a nested record
type Signup = { email: String, city: String }
Form.decode[Signup](text) // ✓In the Book
See also
- Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.form_uncodableshows the same from the installed toolchain, without a network.