You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Goal: Be able to build a struct from another struct even if the field names are different
Context: Serializing a struct currently always makes the keys the name of the fields, this makes this flow not work if you want to build one struct from another:
struct1 has a field income_type
you serialize your instance of struct1 to a hash
you deserialize the hash to build struct2 which has a single field called type
step 3 will raise an error Typed::Validations::RequiredFieldError: type is required. because the hash doesn't have a key for type, but it has a key for `income_type.
Ideally, it'd be great to specify a target for each field. If target is specified, that's what is used for the key name instead of the field name.
The text was updated successfully, but these errors were encountered:
Goal: Be able to build a struct from another struct even if the field names are different
Context: Serializing a struct currently always makes the keys the name of the fields, this makes this flow not work if you want to build one struct from another:
income_type
type
step 3 will raise an error
Typed::Validations::RequiredFieldError: type is required.
because the hash doesn't have a key fortype
, but it has a key for `income_type.Ideally, it'd be great to specify a target for each field. If target is specified, that's what is used for the key name instead of the field name.
The text was updated successfully, but these errors were encountered: