VALIDATION-PLANES-10: Cross into content: a one-field frontmatter schema
What it demonstrates
Section titled “What it demonstrates”contract({frontmatter: z.object({…})}) runs Zod over the parsed frontmatter, line-mapping each issue to its key.
Builds on: VALIDATION-PLANES-02: The smallest contract: one required section
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.
import { z } from "zod";
const c = contract({ frontmatter: z.object({ id: z.string() }), body: sections({}, [section("Summary")]),});// frontmatter missing `id` -> frontmatter/required (document-level: an absent// key has no line; lineForPath pins a *present* key's issue to its source line)Surfaces exercised
Section titled “Surfaces exercised”ContractDef.frontmatter (Zod) (src/core/grammar.ts)frontmatter/required (src/core/content.ts matchFrontmatter)DocTree.frontmatter.lineForPath (src/core/projection.ts)