Skip to content

DECLARATIVE-YAML-13: YAML contract and its TypeScript equivalent, identical findings

That a YAML-authored contract compiles to the same Contract as the combinator API, producing identical findings.

Builds on: DECLARATIVE-YAML-12: Run a YAML config from the CLI

Commands, code, and output together; comments mark which is which.

# YAML
frontmatter:
strict: true
fields:
id: { type: string, pattern: '^T-[0-9A-Z]{4}$' }
status: { enum: [open/ready, closed/done] }
// TypeScript — same contract, same findings
contract({ frontmatter: z.object({
id: z.string().regex(/^T-[0-9A-Z]{4}$/),
status: z.enum(["open/ready", "closed/done"]),
}).strict() })
  • loadContract vs contract({frontmatter})
  • both yield a Contract whose validate() emits the same frontmatter/* findings