Projects /

Project overview

schema-dsl

A TypeScript schema DSL for reusable field rules and input validation.

Use cases and boundaries

Shape and validate input at an application boundary before handing it to business logic. The pure entry exposes the DSL and validation helpers without installing global string extensions. A schema for one record can be reused by the caller wherever the same constraints are intended.

Getting started and compatibility

Install the released package

npm install schema-dsl@3.0.5

Version 3.0.5 requires Node.js 18+. Save the sample as .mjs. It prints true for a valid title and false for a blank one. Checks across records, such as duplicate routes, translation pairs and references, remain application logic. Intent Runtime 3.0.0 requires its own exact Schema DSL 3.0.4 peer.

import { s, validate } from 'schema-dsl/pure';
const titleRecord = s({ title: s('string:3-80!').label('Title') });
console.log(validate(titleRecord, { title: 'Route design' }).valid);
console.log(validate(titleRecord, { title: '' }).valid);

Project relationships