-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Form): add standard schema support to UI v2 #2880
base: dev
Are you sure you want to change the base?
Conversation
state: any, | ||
schema: StandardSchemaV1 | ||
): Promise<ValidateReturnSchema<typeof state>> { | ||
const result = await schema['~standard'].validate(state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why this is different in v3?
The current version breaks Valibot schemas, this would fix that, but I can't tell if Valibot is wrong, the current implementation is wrong, or this PR is wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember why I changed it when I copied it from v3.
Since the beta versions, valibot only supports the standard schema spec.
Valibot changed its implementation several times. That's why Nuxt UI v2 uses 3(!!) different Valibot versions...
This is to prevent breaking changes.
Nuxt UI is not wrong. Valibot is not wrong. This PR might be wrong lol. (it works for me though)
But yeah, I hope @romhml can take a look soon?
For now you can patch Nuxt UI with the changes in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok this is actually broken in V3. The extra value
is added to the path which breaks the error messages. I'll create a PR for V3
edit: PR #3104
Thanks @Gerbuuun! Your PR seems to work with standard schema, but I'm tempted to wait for valibot and standard-schema to release a stable v1 before merging into v2 to avoid breaking changes. I also tested the example in the docs with |
Totally understand. For now I have it patched so it's not a blocker for me! |
π Linked issue
resolves #2879
β Type of change
π Description
Adds standard schema support to forms in UI v2
π Checklist