Skip to content

Commit 1817845

Browse files
os-zhuangclaude
andauthored
fix(spec): align reportForm with the 9.0 dataset-bound ReportSchema (ADR-0021) (#1730)
The authoring form still declared the pre-9.0 query-form fields (objectName / columns / groupingsDown / groupingsAcross / filter) that the single-form cutover removed from ReportSchema — so spec-driven editors rendered controls whose output the schema strips at parse time (and `filter` had been renamed `runtimeFilter`). Declare the dataset-bound shape instead: a Dataset binding section with `dataset` (new `ref:dataset` widget hint) + `values` / `rows` string-tag selectors, `runtimeFilter` under Filter & chart, and joined blocks unchanged. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 695cd29 commit 1817845

2 files changed

Lines changed: 24 additions & 19 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@objectstack/spec": patch
3+
---
4+
5+
reportForm now matches the 9.0 dataset-bound ReportSchema (ADR-0021): the authoring form declares `dataset` / `values` / `rows` / `runtimeFilter` instead of the removed query-form fields (`objectName` / `columns` / `groupingsDown` / `groupingsAcross` / `filter`), so editors no longer offer fields the schema strips at parse time.

packages/spec/src/ui/report.form.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
* `@object-ui/plugin-form` renderer resolves field metadata from the
66
* Zod-derived JSON Schema served by `/api/v1/meta` and applies the
77
* widget/visibility hints declared here.
8+
*
9+
* ADR-0021 single-form: a report is dataset-bound — it binds a semantic-layer
10+
* `dataset` and selects its `values` (measure names) grouped by `rows`
11+
* (dimension names). The legacy inline `objectName` + `columns` + `groupings`
12+
* query form was removed from {@link ReportSchema} in the 9.0 cutover, so this
13+
* form no longer declares those fields.
814
*/
915

1016
import { defineForm } from './view.zod';
@@ -15,47 +21,41 @@ export const reportForm = defineForm({
1521
sections: [
1622
{
1723
label: 'Basics',
18-
description: 'Identity and data source.',
24+
description: 'Identity and report type.',
1925
columns: 2,
2026
fields: [
2127
{ field: 'name', type: 'text', colSpan: 1, required: true, helpText: 'snake_case unique identifier' },
2228
{ field: 'label', type: 'text', colSpan: 1, required: true },
2329
{ field: 'description', type: 'textarea', colSpan: 2 },
24-
{ field: 'objectName', widget: 'ref:object', colSpan: 1, helpText: 'Data source object' },
25-
{ field: 'type', colSpan: 1, helpText: 'Report type: tabular/summary/matrix/joined' },
26-
],
27-
},
28-
{
29-
label: 'Columns',
30-
description: 'Columns shown in the report output.',
31-
fields: [
32-
{ field: 'columns', type: 'repeater', helpText: 'Columns to display in the report' },
30+
{ field: 'type', colSpan: 2, helpText: 'Report type: tabular/summary/matrix/joined' },
3331
],
3432
},
3533
{
36-
label: 'Groupings',
37-
description: 'How rows (and columns, for matrix reports) are grouped.',
34+
label: 'Dataset binding',
35+
description: 'The semantic-layer dataset this report renders. Values are the dataset’s measures; rows are its dimensions.',
36+
// A `joined` report carries its data on `blocks` instead.
37+
visibleOn: "data.type != 'joined'",
3838
fields: [
39-
{ field: 'groupingsDown', type: 'repeater', helpText: 'Row grouping levels' },
40-
// CEL visibility — only Matrix reports use column groupings.
41-
{ field: 'groupingsAcross', type: 'repeater', visibleOn: "data.type == 'matrix'", helpText: 'Column grouping levels (matrix only)' },
39+
{ field: 'dataset', widget: 'ref:dataset', helpText: 'Dataset to bind (measures/dimensions come from its semantic layer)' },
40+
{ field: 'values', widget: 'string-tags', helpText: 'Measure names (from the dataset) to display' },
41+
{ field: 'rows', widget: 'string-tags', helpText: 'Dimension names (from the dataset) to group rows by' },
4242
],
4343
},
4444
{
4545
label: 'Joined blocks',
46-
description: 'Additional blocks joined into a single report (joined reports only).',
46+
description: 'Additional dataset-bound blocks stacked into a single report (joined reports only).',
4747
visibleOn: "data.type == 'joined'",
4848
fields: [
49-
{ field: 'blocks', type: 'repeater', helpText: 'Join multiple objects (joined report only)' },
49+
{ field: 'blocks', type: 'repeater', helpText: 'Dataset-bound sub-reports (joined report only)' },
5050
],
5151
},
5252
{
5353
label: 'Filter & chart',
54-
description: 'Report-level filters and chart presentation.',
54+
description: 'Render-time scope filter and chart presentation.',
5555
collapsible: true,
5656
collapsed: true,
5757
fields: [
58-
{ field: 'filter', type: 'repeater', helpText: 'Report-level filters' },
58+
{ field: 'runtimeFilter', widget: 'json', helpText: 'Render-time scope filter, ANDed at query time' },
5959
{ field: 'chart', type: 'composite', helpText: 'Chart config (type, legend, colors)' },
6060
],
6161
},

0 commit comments

Comments
 (0)