vercel-labs / vercel-labs/json-render

fix: Element visible field rejected as required under Zod 4.4

Open
#287 0 comments 3 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.