VALIDATION-PLANES-12: Typed table columns with a per-row constraint
What it demonstrates
Section titled “What it demonstrates”table({columns, cells, minRows}) types each named column with Zod and flags a bad cell at that row’s source line.
Builds on: VALIDATION-PLANES-07: Require a block kind: a table
How it’s done
Section titled “How it’s done”A TypeScript program against the library API; inline comments show the resulting values and behavior.
const c = contract({ body: sections({}, [ section("Changes", { content: table({ columns: ["File", "Kind"], cells: { Kind: z.enum(["add", "modify", "delete"]) }, minRows: 1, }) }),]) });// a row whose Kind is "tweak" -> content/table/cell at that row's lineSurfaces exercised
Section titled “Surfaces exercised”table() cells / minRows (src/core/leaves.ts)per-column Zod over each row (src/core/content.ts validateTable)content/table/cell pinned via rowPos(i)