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: Add Standard Schema validator to Qwik Router #7281

Draft
wants to merge 3 commits into
base: build/v2
Choose a base branch
from

Conversation

fabian-hiller
Copy link
Contributor

@fabian-hiller fabian-hiller commented Jan 25, 2025

What is it?

  • Feature / enhancement

Description

I implemented a schema$ validator function based on Standard Schema that should replace zod$ and valibot$ in the long run.

I added type-fest to simplify the type implementation, but I could write the types mysefle instead. Please give me feedback.

New features:

  • Add new schema$ function that supports any Standard Schema copatiple schema library including Zod, ArkType and Valibot

Breaking changes:

  • Remove export of Zod's z
    • Users should import that from Zod directly
  • Change return type of .fieldErrors
    • Arrays paths are changed from array[].key to array.${number}.key
    • This allows to directly access specific array index error messages
    • Furthermore, it simplifies the implementation

Other changes:

  • Deprecate zod$ and valibot$ as well as any directly related functions and types
    • We could also remove valibot$ as it was in @beta stage and marked as experimental

Checklist

  • My code follows the developer guidelines of this project
  • I performed a self-review of my own code
  • I added a changeset with pnpm change
  • I made corresponding changes to the Qwik docs
  • I added new tests to cover the fix / functionality

Copy link

changeset-bot bot commented Jan 25, 2025

⚠️ No Changeset found

Latest commit: 1a25c54

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@fabian-hiller
Copy link
Contributor Author

fabian-hiller commented Jan 26, 2025

Please give me feedback on the changes and implementation. Once everything looks good and it is planned to merge the PR, I (or someone else) can update tests and docs.

Copy link
Member

@wmertens wmertens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haven't looked closely yet, but we should have type tests in the unit tests

packages/qwik/src/optimizer/src/qwik-binding-map.ts Outdated Show resolved Hide resolved
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