effect-app / libs

The core libraries to build apps with Effect
44 stars 6 forks source link

Consider processing nested defaultValues #112

Open patroza opened 1 day ago

patroza commented 1 day ago

e.g you add a new object, add a defaultValue for it, but then you add a new field to it. in this case, the data already has the object, just incomplete. we could consider doing nested default values, I think Cosmos does this internally too.

        defaultValues: {
          additionalInfo: {
            logo: null,
            description: null // new field
          }
        }
  ParseError: ReadonlyArray<(Security (Encoded side) <-> Security)>
  └─ [0]
     └─ (Security (Encoded side) <-> Security)
        └─ Encoded side transformation failure
           └─ Security (Encoded side)
              └─ ["additionalInfo"]
                 └─ { readonly logo: NonEmptyString255 | null; readonly description: (Translated (Encoded side) <-> Translated) | null }
                    └─ ["description"]
                       └─ is missing

the current workaround would be to use a more customised/advanced jitM function, but it is not as useful as defaultValues in other ways.