UForm: apply transformations from the validator
Description
I'm using Zod for validation, and it has .transform(). For example, you can trim a string:
import { z } from 'zod';
const schema = z.string().trim().min(1, "String must not be empty!");
Now, after running schema.parse(), Zod returns the trimmed string, as expected:
console.log(schema.parse(" a")); // "a"
console.log(schema.parse("b ")); // "b"
But in the submit event, nuxt ui form provides data directly from the form state, without the transformations. This is hard to call a bug, but at the same time I would expect for the form data to be run through Zod, for all the transformations to apply.
Additional context
No response
@romhml Is this done in v3 already?
Not yet, I'll tackle this one soon
Hi, can I work on this issue in v2? @benjamincanac
Sure :)
thank you @benjamincanac