fix(spec): make GanttConfigSchema forward-compatible via .passthrough()#2170
Merged
Conversation
The gantt renderer (objectui plugin-gantt) keeps adding view-config knobs (lockField, defaultCollapsedDepth, ...) ahead of this schema. The console validates the view config against a bundled copy of GanttConfigSchema before handing it to the renderer, so any field not declared here is stripped -- every new renderer knob otherwise needs a spec release + console rebuild to take effect. .passthrough() lets unknown fields reach the renderer, decoupling renderer releases from spec releases. Known fields keep their validation. Adds a forward-compat test asserting unknown fields survive parse.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 89 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
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.
What
GanttConfigSchema(packages/spec/src/ui/view.zod.ts) is a closedz.object— it strips any field it doesn't explicitly declare. This change appends.passthrough()so unknown fields survive validation.Why
The gantt renderer (objectui
plugin-gantt) keeps adding view-config knobs ahead of this schema — e.g.lockField/defaultCollapsedDepthfrom objectui#1870, and previouslyparentField/typeField(#2030).The console validates a view's
config.ganttagainst a bundled copy of this schema before handing it to the renderer. So every field not declared here is silently dropped — meaning each new renderer knob requires a spec release and a console rebuild before it can take effect. Downstream this forces localpatch-package-style patches that re-add.passthrough()to the bundled schema..passthrough()decouples renderer releases from spec releases: unknown fields flow through to the renderer (which still only reads what it understands), while all declared fields keep their validation.Tests
view.test.ts: unknown fields (lockField,defaultCollapsedDepth) surviveparse().