Skip to content

DECLARATIVE-YAML-03: Bound and shape strings with min/max, pattern, format

Adding numeric bounds, a regex pattern, and a named string format to a typed field.

Builds on: DECLARATIVE-YAML-02: Constrain with enum and const

The declarative YAML artifact, verbatim — no code required.

frontmatter:
fields:
id: { type: string, pattern: '^D-\d{4}$' }
title: { type: string, min: 1, max: 80 }
created: { type: string, format: date }
contact: { type: string, format: email }
weight: { type: number, int: true, min: 0, max: 5 }
  • schema.ts typed(): .min/.max
  • .regex(pattern)
  • STRING_FORMATS (date/email -> z.iso.date()/z.email())
  • int -> z.int()