Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .changeset/gantt-config-passthrough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@objectstack/spec": patch
---

fix(spec): make `GanttConfigSchema` forward-compatible via `.passthrough()`.

The gantt renderer (objectui plugin-gantt) keeps adding view-config knobs
(e.g. `lockField`, `defaultCollapsedDepth`) ahead of this schema. Without
passthrough, the console — which validates the view config against a bundled
copy of this schema before handing it to the renderer — strips any field not
declared here, so every new renderer knob needs a spec release + console
rebuild before it can take effect. Adding `.passthrough()` lets unknown fields
flow through to the renderer, decoupling renderer releases from spec releases.
Known fields keep their validation; the renderer still only reads what it
understands.
14 changes: 14 additions & 0 deletions packages/spec/src/ui/view.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,20 @@ describe('GanttConfigSchema', () => {
expect(() => GanttConfigSchema.parse(config)).not.toThrow();
expect(GanttConfigSchema.parse(config)).toMatchObject({ parentField: 'parent_id', typeField: 'row_type' });
});

it('should passthrough unknown renderer fields ahead of this schema', () => {
const config = {
startDateField: 'start_date',
endDateField: 'end_date',
titleField: 'name',
// Newer renderer knobs not yet declared here (e.g. objectui plugin-gantt).
lockField: 'is_locked',
defaultCollapsedDepth: 2,
};

expect(() => GanttConfigSchema.parse(config)).not.toThrow();
expect(GanttConfigSchema.parse(config)).toMatchObject({ lockField: 'is_locked', defaultCollapsedDepth: 2 });
});
});

describe('ListViewSchema', () => {
Expand Down
6 changes: 5 additions & 1 deletion packages/spec/src/ui/view.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,11 @@ export const GanttConfigSchema = lazySchema(() => z.object({
])).optional().describe('Fields to surface in the hover tooltip, in display order'),
quickFilters: z.array(GanttQuickFilterSchema).optional().describe('Multi-select filter dropdowns rendered above the chart'),
autoZoomToFilter: z.boolean().optional().describe('When true (default), filtering zooms the range to the filtered tasks'),
}));
// Forward-compatible: the gantt renderer (objectui plugin-gantt) keeps adding
// config knobs (e.g. lockField / defaultCollapsedDepth) ahead of this schema.
// Passthrough lets those extra fields reach the renderer instead of being
// stripped here, so a renderer release no longer has to wait on a spec release.
}).passthrough());

/**
* Navigation Mode Enum
Expand Down
Loading