Skip to content

fix(core): preserve runtime fields in validate() with passthrough#255

Open
tmchow wants to merge 1 commit intovercel-labs:mainfrom
tmchow:osc/222-fix-validate-preserve-runtime-fields
Open

fix(core): preserve runtime fields in validate() with passthrough#255
tmchow wants to merge 1 commit intovercel-labs:mainfrom
tmchow:osc/222-fix-validate-preserve-runtime-fields

Conversation

@tmchow
Copy link
Copy Markdown

@tmchow tmchow commented Apr 2, 2026

Summary

catalog.validate() silently strips on, repeat, watch, and state from element objects because Zod's default parse mode removes unknown keys.

Changes

packages/core/src/schema.ts: Added .passthrough() to object schemas in buildZodType() so unknown keys survive validation. Also applied to record schemas when their values are objects. Known fields are still validated; unknown fields (runtime fields like on, repeat, watch, state) pass through unchanged.

Testing

All 892 existing tests pass. pnpm type-check passes.

Fixes #222

This contribution was developed with AI assistance (Codex).

Zod's default parse mode strips unknown keys. Element runtime fields
(on, repeat, watch, state) aren't in the validation schema, so they
were silently removed. Use .passthrough() on object and record schemas
so unknown keys survive validation while known fields are still checked.

Fixes vercel-labs#222
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 2, 2026

@tmchow is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

catalog.validate() silently strips on, repeat, watch, and state from specs

1 participant