Closed ktkk closed 1 month ago
I have the following schema:
const InputSchema = object({ input: pipe(nullish(pipe(number(), integer())), transform(x => x === null ? undefined : x)), });
which I use on my backend to validate and coerce input from a Flutter app (Dart has no concept of undefined).
undefined
I was wondering if Valibot has built in functionality for this transform that I'm missing. If not, I think this would be a valuable addition.
Nevermind, I overlooked the default parameter of nullish. My schema now looks like this:
default
nullish
const InputSchema = object({ input: nullish(pipe(number(), integer()), undefined), });
I have the following schema:
which I use on my backend to validate and coerce input from a Flutter app (Dart has no concept of
undefined
).I was wondering if Valibot has built in functionality for this transform that I'm missing. If not, I think this would be a valuable addition.