Repository navigation
Introduce Zod validation framework - #15
Merged
Merged
Conversation
- Add Zod 4 as schema validation library with @hookform/resolvers - Create env.ts with schemas for client/server environment variables - Create server/validation.ts with slugSchema, idSchema, collectionSchema - Add route parameter validation to pages/[slug], meditations/[id], m/[id], preview - Update payload-client.ts with Zod-based config validation - Update cms-context.ts with server environment validation - Add optional schema prop to FormBuilder for Zod form validation - Update types/vike.d.ts with ImportMetaEnv interface - Update CLAUDE.md with Zod validation documentation Closes #14 Co-Authored-By: Claude Opus 4.5 <[email protected]>
Deploying wemeditate-design with
|
| Latest commit: |
2f9c4fa
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://341c40f8.wm-design.pages.dev |
| Branch Preview URL: | https://feature-zod-validation.wm-design.pages.dev |
- Remove env.ts (schemas were never used after vite-plugin-validate-env removal) - Remove unused VALID_LOCALES and localeSchema from validation.ts - Update CLAUDE.md to reflect simplified structure Co-Authored-By: Claude Opus 4.5 <[email protected]>
Vike's render() function only accepts specific status codes: 401, 403, 404, 410, 429, 500, 503. The 400 status code is explicitly not recommended per Vike documentation. For invalid route parameters (malformed slugs/IDs), 404 is the appropriate code since the resource doesn't exist with that invalid identifier. Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Extract shared apiKeySchema and baseUrlSchema to validation.ts - Update cms-context.ts and payload-client.ts to use shared schemas - Add whitespace-only API key test case (restoring lost coverage) - Use consistent "API key" error message naming Co-Authored-By: Claude Opus 4.5 <[email protected]>
sydevs-bot
pushed a commit
that referenced
this pull request
Nov 19, 2026
`types/vike.d.ts` sent readers to `env.ts` for the environment schemas, but that file was removed in #15 because nothing used it. `.env.example` is where each variable is documented now. `lib/live-preview/frame-editor.ts` named `./messages.ts` as the home of the unsaved-edit stream, and `document.tsx` described its endpoint check as replacing a filter that "used to live" there. That module is gone; the stream is `./document.tsx`, and its endpoint check is the one filter, which is what the comment now says. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
schemaprop to FormBuilder for Zod-powered form validationChanges
New Files
env.ts- Central Zod schemas for client/server environment variablesserver/validation.ts- Shared schemas for slugs, IDs, locales, and collection typesModified Files
server/payload-client.ts- Zod-based config validation withPayloadConfigErrorserver/cms-context.ts- Server environment validationpages/[slug]/+data.ts- Slug validation (400 for invalid slugs)pages/meditations/[id]/+data.ts- ID validation (400 for invalid IDs)pages/m/[id]/+data.ts- ID validation for embed routepages/preview/+data.ts- Collection and ID validationcomponents/organisms/FormBuilder/FormBuilder.tsx- Optionalschemaproptypes/vike.d.ts-ImportMetaEnvinterface for typed env varsCLAUDE.md- Zod validation documentationTest plan
pnpm test:run)pnpm build)/about- valid slug loads/ABOUT- returns 400 (invalid slug format)/meditations/123- valid numeric ID loads/meditations/abc- returns 400 (invalid ID)/preview?collection=pages&id=1- preview loads/preview?collection=invalid&id=1- returns 400 (invalid collection)Closes #14
🤖 Generated with Claude Code