Skip to content

Commit b4ef588

Browse files
authored
feat(types): derive ListViewSchema from @objectstack/spec/ui (#2231) (#2622)
Replace the hand-written ListView zod mirror + TS interface in @object-ui/types with a derivation from the authoritative @objectstack/spec/ui ListViewSchema. Spec-owned fields flow in by reference; the component envelope (type:'list-view' + objectName) and legacy objectui vocabulary (viewType/fields/filters/show*/densityMode/...) remain sanctioned local extensions. Adds a drift-guard parity test so the copies can't silently diverge again. Bumps @objectstack/spec ^14.6.0 -> ^15.1.0 (15.1.0 carries the framework#3021 lazySchema/z.toJSONSchema identity fix).
1 parent 077e45b commit b4ef588

20 files changed

Lines changed: 452 additions & 616 deletions

File tree

.changeset/listview-spec-derive.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
"@object-ui/types": minor
3+
---
4+
5+
feat(types): derive `ListViewSchema` from `@objectstack/spec/ui` instead of a hand-written copy (#2231)
6+
7+
`@object-ui/types` shipped a hand-written mirror of the spec's UI ListView zod
8+
(`packages/types/src/zod/objectql.zod.ts`) plus a parallel hand-written TS `interface`
9+
(`objectql.ts`). Both had drifted from the authoritative `@objectstack/spec/ui`
10+
`ListViewSchema`, with nothing enforcing they stay in sync.
11+
12+
- The zod `ListViewSchema` now **derives** from the spec's `ListViewSchema`: spec-owned
13+
fields (`filter`, `sort`, `selection`, `navigation`, `pagination`, `grouping`,
14+
`rowColor`, `userActions`, `appearance`, `tabs`, `addRecord`, `rowHeight`, `sharing`,
15+
`chart`/`tree` configs, `responsive`, `performance`, …) flow in **by reference** instead
16+
of being re-typed. The component envelope (`type: 'list-view'` discriminator +
17+
`objectName`) and the legacy objectui vocabulary (`viewType`, `fields`, `filters`, the
18+
`show*` toolbar flags, `densityMode`, `color`, …) plus the configs whose objectui shape
19+
is intentionally broader than spec's (`userFilters`, `sharing`, `aria`,
20+
`conditionalFormatting`, `exportOptions`, `kanban`/`calendar`/`gantt`/`gallery`/
21+
`timeline`) remain as sanctioned local `.extend()`s. Existing payloads keep validating;
22+
spec-canonical payloads (`columns`/`filter`/`userActions`) now validate too.
23+
- The hand-written TS `interface ListViewSchema` is replaced by
24+
`z.infer<typeof ListViewSchema> & ListViewRuntimeProps`, so the type can no longer drift
25+
from the schema. Non-serializable runtime-only props (`onNavigate`, `onDensityChange`,
26+
`refreshTrigger`) live in `ListViewRuntimeProps`.
27+
- Added a drift-guard test (`list-view-spec-parity.test.ts`) that fails if the spec grows a
28+
field objectui hasn't triaged, renames an aliased anchor (`type`/`columns`/`filter`), or
29+
an objectui-only field is added outside the sanctioned-local set.
30+
- Bumped the `@objectstack/spec` dependency `^14.6.0``^15.1.0` across the workspace
31+
(15.1.0 carries the framework#3021 `lazySchema`/`z.toJSONSchema` identity fix that the
32+
spec-derived Page/View inspectors depend on).
33+
34+
Migrating the legacy vocabulary to the spec-canonical keys and adopting spec's narrower
35+
sub-shapes are deferred follow-ups (see #2231). No runtime behavior change.

apps/console/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"@object-ui/react": "workspace:*",
8989
"@object-ui/types": "workspace:*",
9090
"@objectstack/client": "^14.6.0",
91-
"@objectstack/spec": "^14.6.0",
91+
"@objectstack/spec": "^15.1.0",
9292
"@tailwindcss/postcss": "^4.3.2",
9393
"@tailwindcss/typography": "^0.5.20",
9494
"@testing-library/jest-dom": "^6.9.1",
@@ -113,8 +113,8 @@
113113
"vitest": "^4.1.10"
114114
},
115115
"dependencies": {
116-
"@object-ui/sdui-parser": "workspace:*",
117116
"@object-ui/react-runtime": "workspace:*",
117+
"@object-ui/sdui-parser": "workspace:*",
118118
"sucrase": "^3.35.0"
119119
}
120120
}

apps/site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@object-ui/plugin-view": "workspace:*",
3232
"@object-ui/react": "workspace:*",
3333
"@object-ui/types": "workspace:*",
34-
"@objectstack/spec": "^14.6.0",
34+
"@objectstack/spec": "^15.1.0",
3535
"fumadocs-core": "16.11.3",
3636
"fumadocs-mdx": "15.0.13",
3737
"fumadocs-ui": "16.11.3",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"devDependencies": {
6262
"@changesets/cli": "^2.31.0",
6363
"@eslint/js": "^10.0.1",
64-
"@objectstack/spec": "^14.6.0",
64+
"@objectstack/spec": "^15.1.0",
6565
"@playwright/test": "^1.61.1",
6666
"@testing-library/dom": "^10.4.1",
6767
"@testing-library/jest-dom": "^6.9.1",

packages/app-shell/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@object-ui/types": "workspace:*",
5151
"@objectstack/formula": "^14.6.0",
5252
"@objectstack/lint": "^14.6.0",
53-
"@objectstack/spec": "^14.6.0",
53+
"@objectstack/spec": "^15.1.0",
5454
"@sentry/react": "^10.65.0",
5555
"jsonc-parser": "^3.3.1",
5656
"lucide-react": "^1.24.0",

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"dependencies": {
3434
"@object-ui/types": "workspace:*",
3535
"@objectstack/formula": "^14.6.0",
36-
"@objectstack/spec": "^14.6.0",
36+
"@objectstack/spec": "^15.1.0",
3737
"lodash": "^4.18.1",
3838
"zod": "^4.4.3"
3939
},

packages/plugin-detail/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"dependencies": {
3434
"@object-ui/i18n": "workspace:*",
35-
"@objectstack/spec": "^14.6.0",
35+
"@objectstack/spec": "^15.1.0",
3636
"lucide-react": "^1.24.0"
3737
},
3838
"peerDependencies": {

packages/plugin-form/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@object-ui/permissions": "workspace:*",
2828
"@object-ui/react": "workspace:*",
2929
"@object-ui/types": "workspace:*",
30-
"@objectstack/spec": "^14.6.0",
30+
"@objectstack/spec": "^15.1.0",
3131
"lucide-react": "^1.24.0"
3232
},
3333
"peerDependencies": {

packages/plugin-gantt/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@object-ui/plugin-detail": "workspace:*",
3939
"@object-ui/react": "workspace:*",
4040
"@object-ui/types": "workspace:*",
41-
"@objectstack/spec": "^14.6.0",
41+
"@objectstack/spec": "^15.1.0",
4242
"lucide-react": "^1.24.0",
4343
"qrcode": "^1.5.4",
4444
"sonner": "^2.0.7"

packages/plugin-map/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@object-ui/core": "workspace:*",
3636
"@object-ui/react": "workspace:*",
3737
"@object-ui/types": "workspace:*",
38-
"@objectstack/spec": "^14.6.0",
38+
"@objectstack/spec": "^15.1.0",
3939
"lucide-react": "^1.24.0",
4040
"maplibre-gl": "^5.24.0",
4141
"react-map-gl": "^8.1.1",

0 commit comments

Comments
 (0)