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
19 changes: 19 additions & 0 deletions .changeset/8885-object-chart-drilldown-title-compareto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"@object-ui/types": minor
---

`ObjectChartSchema` declares `drillDown`, `title` and `compareTo` — on BOTH published copies of the shape.

`ObjectChart.tsx` reads all three off `schema`, and until now neither published copy declared any of them: not the TS interface (`packages/types/src/objectql.ts`) and not the zod mirror (`packages/types/src/zod/objectql.zod.ts`). They rode `BaseSchema`'s index signature / `.passthrough()` and arrived unvalidated. `drillDown` was the sharpest case — this component's registry `inputs` advertise it to the designer palette, and `@objectstack/spec` publishes `ChartDrillDownSchema` for exactly this carrier, so an author was offered a key that neither published shape mentioned.

Each key binds to the `@objectstack/spec` symbol that already owns it rather than to a local near-copy:

- `drillDown` is the spec's `ChartDrillDown` / `ChartDrillDownSchema`, whose own documentation names `<ObjectChart drillDown={…}>` as its carrier. Deliberately NOT this repo's wider `DrillDownConfig`: that type also carries `mode` and `report` for the table / pivot / metric widgets, and this component reads neither — so a chart drill now refuses those two by name instead of accepting and dropping them.
- `title` is the spec's `I18nLabel` — a plain string or an inline locale map, the union `normalizeChartSchema`'s `label()` already resolves and the union `ChartConfigSchema.title` carries.
- `compareTo` is bound by reference to `DashboardWidgetSchema.shape.compareTo`, which is literally where the value comes from: `DashboardRenderer` forwards the dashboard widget's own key verbatim onto the node.

What this buys is the VALUE check. `title: 42`, `drillDown: { target: 'popover' }` and `compareTo: { kind: 'lastWeek' }` are now compile errors and parse errors; before, all three rode through silently. It does not buy rejection of a misspelling — `BaseSchema` still carries `[key: string]: any` and is still `.passthrough()` — and the pin for this change states that bound honestly rather than implying more.

Four keys the same file reads (`xAxisKey`, `series`, `aggregate`, `filter`) belong to objectui#7946 and are ledgered by name, each with an assertion that it is still read, rather than swept in here.

Part of objectui#8885.
2 changes: 1 addition & 1 deletion docs/audits/2026-07-objectview-detailview-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ wrong thing.** The prerequisite is to make the declaration match the reads.
| objectui | Spec | Note |
| --- | --- | --- |
| `objectName` | `data: { provider: 'object', object }` (`ViewDataSchema`, `:29`) | Same divergence as scope A step 6 — and the same upstream blocker (`react-blocks.ts` sanctions `objectName` as a React-tier prop). Move together, or not at all. |
| `defaultViewType` | `ListViewSchema.type` (`:643`) | Spec is a superset (adds `chart`, `tree`). objectui's own `ListViewSchema` **already imports this enum by reference** (`objectql.zod.ts:365`) — this schema should use the same import instead of restating a narrower copy. |
| `defaultViewType` | `ListViewSchema.type` (`:646`) | Spec is a superset (adds `chart`, `tree`). objectui's own `ListViewSchema` **already imports this enum by reference** (`objectql.zod.ts:368`) — this schema should use the same import instead of restating a narrower copy. |
| `showSearch` / `showFilters` / `showSort` | `UserActionsConfigSchema.{search,filter,sort}` (`:350-352`) | Scope A step 3, same fold. |
| `showCreate` | `AddRecordConfigSchema.enabled` (`:448`) | Spec's config also carries `position` / `mode` / `formView`; the boolean is a lossy shorthand for it. |
| `title` | `label` (`:642`) | Type differs: objectui `z.string()`, spec `I18nLabelSchema`. Promoting means accepting the i18n envelope. |
Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/__tests__/imported-defaults-8317.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import {
NavigationConfigSchema as SpecNavigationConfigSchema,
I18nLabelSchema as SpecI18nLabelSchema,
ChartAggregateSchema as SpecChartAggregateSchema,
ChartDrillDownSchema as SpecChartDrillDownSchema,
} from '@objectstack/spec/ui';
import { SelectOptionSchema as SpecSelectOptionSchema } from '@objectstack/spec/data';
import { stripImportedDefaults } from '../zod/imported-defaults.js';
Expand Down Expand Up @@ -175,6 +176,8 @@ const IMPORTED: Array<readonly [string, z.ZodType]> = [
['NavigationConfigSchema', SpecNavigationConfigSchema],
['I18nLabelSchema', SpecI18nLabelSchema],
['ChartAggregateSchema', SpecChartAggregateSchema],
// objectui#8885: `ObjectChartSchema.drillDown` crosses this boundary.
['ChartDrillDownSchema', SpecChartDrillDownSchema],
['SelectOptionSchema', SpecSelectOptionSchema],
] as const;

Expand Down
Loading
Loading