Skip to content
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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Gerbuuun
Copy link

πŸ”— Linked issue

resolves #2879

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Adds standard schema support to forms in UI v2

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@benjamincanac benjamincanac requested a review from romhml December 11, 2024 15:34
@Gerbuuun Gerbuuun changed the title feat: add standard schema support to UI v2 feat(Form): add standard schema support to UI v2 Dec 13, 2024
state: any,
schema: StandardSchemaV1
): Promise<ValidateReturnSchema<typeof state>> {
const result = await schema['~standard'].validate(state)
Copy link

@OhB00 OhB00 Dec 18, 2024

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?

Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants