Use default value when decoding fails
Let's say we have a struct with field that accepts multiple literals. I want to decode it in a way, that if the decoding of the field fails, the
I was used to doing it in a zod like this:
So object like this
Is it possible to do with some transformer in schema?
unknown is set as a value.I was used to doing it in a zod like this:
So object like this
{someLiterals: 'valueC'} gets encoded into {someLiterals: 'unknown'}.Is it possible to do with some transformer in schema?
