Runtype
Changelog
FeatureJuly 12, 20261 min read

Schemas for your records

Define a JSON Schema for a record type, validate writes in warn or enforce mode, and use the same collection workflow through REST, SDK, MCP, and CLI.

recordscollectionsschemaapi

Records are flexible by default. Record Collections add an optional contract when your data needs a dependable shape. Create a collection for a record type, attach a constrained JSON Schema, and Runtype validates writes from every supported record-writing path.

  • Start from the data you already have. Infer a proposed schema from existing records, then review it before saving.
  • Adopt validation gradually. Start in warn mode to receive field-level schemaWarnings without blocking writes. Switch to enforce when you are ready to reject invalid writes with a structured 422 response.
  • Check before enforcing. Validate existing records against a candidate or saved schema without changing them, including field-level examples for records that do not match.
  • Evolve schemas safely. Collection schema changes are versioned, and breaking changes require leaving enforce mode first.

The complete workflow is available through /v1/collections, client.collections in the TypeScript SDK, seven MCP tools, and runtype collections in the CLI.