Skip to content

feat: Add Standard Schema validator to Qwik Router - #7281

Closed
fabian-hiller wants to merge 3 commits into
QwikDev:mainfrom
fabian-hiller:feat-add-standard-schema-function
Closed

fabian-hiller wants to merge 3 commits into
QwikDev:mainfrom
fabian-hiller:feat-add-standard-schema-function

Conversation

@fabian-hiller

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

Copy link
Copy Markdown
Contributor

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

@changeset-bot

changeset-bot Bot commented Jan 25, 2025 •

Copy link
Copy Markdown

⚠️ 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

fabian-hiller commented Jan 26, 2025 •

Copy link
Copy Markdown
Contributor Author

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.

@wmertens wmertens left a comment

Copy link
Copy Markdown
Member

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

Comment thread packages/qwik/src/optimizer/src/qwik-binding-map.ts
@gabrielgrant

gabrielgrant commented Feb 9, 2025 •

Copy link
Copy Markdown
Contributor

Any updates on this? Would very much like to be using ArkType with Qwik through this Standard Schema support!

Edit: seems some of the tests need to be updated for the .fieldErrors changes? https://github.com/QwikDev/qwik/actions/runs/12976594745/job/36190521067?pr=7281#step:8:59

@fabian-hiller

Copy link
Copy Markdown
Contributor Author

Unfortunately, I do not have time to finish this PR, but I think @wmertens will take it over.

@gabrielgrant gabrielgrant mentioned this pull request Jun 8, 2026
5 tasks done
@wmertens
wmertens changed the base branch from build/v2 to main July 16, 2026 14:51
@wmertens

wmertens commented Oct 4, 2026

Copy link
Copy Markdown
Member

Closing this in favor of an upcoming PR, which will be based on #8707

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.

3 participants