vercel-labs / vercel-labs/json-render
fix: Element visible field rejected as required under Zod 4.4
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 16.8k
- Forks
- 901
- Avg merge
- 3h 14m
- Merged PRs (30d)
- 4
Description
Hey I'm running into a validation failure after bumping zod 4.3.6 → 4.4.3 in our app.
Using @json-render/react@0.18.0 (also checked 0.19.0 on npm, same behaviour, and this is what made me notice the github release mismatch).
The visible field on elements is now being treated as required
import { z } from 'zod';
import { schema } from '@json-render/react';
const catalog = schema.createCatalog({
components: {
Stack: { props: z.object({}), description: 'box', example: {} },
},
actions: {},
});
const result = catalog.validate({
root: 'main',
elements: {
main: { type: 'Stack', props: {}, children: [] },
},
});
console.log(result);
// {
// success: false,
// error: ZodError: [
// {
// code: 'invalid_type',
// expected: 'nonoptional',
// path: [ 'elements', 'main', 'visible' ],
// message: 'Invalid input: expected nonoptional, received undefined'
// }
// ]
// }
On zod 4.3.6 the same call succeeds. Not sure if this is a zod 4.4 compatibility thing or something on our end.
Versions:
- @json-render/core@0.18.0, @json-render/react@0.18.0, @json-render/shadcn@0.18.0, (about to install @json-render/react-email@0.18.0)
- zod@4.4.3 (any 4.4.x reproduces)
- Node 24, pnpm 10
Happy to dig in further if useful
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report using schema.createCatalog and catalog.validate with the supplied TypeScript example, comparing Zod 4.3.6 with 4.4.x. Trace the schema used for elements and visible from those entry points; done means the same catalog input validates successfully on Zod 4.4.x without making visible required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100