Standard schema validator - #8707
Conversation
🦋 Changeset detectedLatest commit: dba8561 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
|
AFAICT these CI failures seem to be timeouts setting up playwright, not actual failures, but I don't believe I'm able to re-run the jobs without pushing dummy commits to the branch |
|
Would be great if @wmertens and @fabian-hiller could take a look at this when you have a moment. Thank you! A few specific design questions:
|
052db94 to
5196de8
Compare
@qwik.dev/core
@qwik.dev/router
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
commit: |
|
This is now rebased onto/PRed against build/v2 Since this was originally against v1, I left the existing explicit integrations with Valibot & Zod intact. If this is going to be added as part of the v2 transition, though, it's possible we may want to remove/deprecate those lib-specific integrations, and promote |
| ```tsx | ||
| import { component$ } from '@qwik.dev/core'; | ||
| import { Form, routeAction$, schema$ } from '@qwik.dev/router'; | ||
| import { z } from 'zod'; |
There was a problem hiding this comment.
you have to import * as z from 'zod' so that tree shaking works
| schema$(() => | ||
| createStandardSchema<{ id: string }, { id: number }>((value) => ({ | ||
| value: { id: Number((value as { id: string }).id) }, | ||
| })) | ||
| ) |
There was a problem hiding this comment.
QRLs can hold objects with functions in them, so maybe that would be a more ergonomic definition?
schema$({ validate: v => ({ value: { id: Number((value as { id: string }).id) } })})(no idea what I'm doing)
What is it?
Feature / enhancement
Description
Moves forward the work started previously in #7518 and #7281 to add Standard Schema support
Checklist
pnpm change