Skip to content

Validate Query/Mutation output shapes against component prop types #463

@ChuckJonas

Description

@ChuckJonas

Is your feature request related to a problem? Please describe.

There's no way to test that data from Query()/Mutation() calls will actually work with the components they're bound to without rendering the full UI. If a query returns the wrong shape, you only find out at render time.

Describe the solution you'd like

A way to pass mock query results into the parser or a test utility and get back validation errors — basically a dry run of the data binding without rendering.

const errors = validateView(code, library, {
  portfolio_summary: { total: 5 },
  holdings: [{ sector: "Tech", value: 50000 }],
});

// -> [{ path: "summary.sectors", component: "PieChart", prop: "data",
//        message: "property 'sectors' not found in query output" }]

Feed it the OpenUI Lang, the library, and the query outputs — get back a list of binding mismatches. Missing keys, type mismatches (scalar where array expected), etc.

Describe alternatives you've considered

Rendering with onError to catch failures, but that requires the full renderer and only reports the first error.

Additional context

This would be useful for CI checks, save-time validation, and any workflow where views are persisted and re-rendered without an LLM in the loop to self-correct.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions