typestack/class-validator — reverse-engineered prompt

Reverse engineered prompt

GitHub

Build me a TypeScript library for validating class objects using simple property decorators, like putting rules directly on fields and then calling validate to get a list of readable errors.

It should work in both Node.js and the browser. I want decorators for common checks like email, length, numbers, dates, min and max, plus support for arrays, sets, maps, nested objects, promises, conditional rules, validation groups, and skipping missing values. Please include async validation, a validateOrReject helper, and a sync option too.

The errors should clearly say which property failed, what value failed, and which rules failed. Let people customize messages with simple text or a function. Also support custom validators and custom decorators, plus a way to validate without decorators using a schema.

Please add good tests, examples, and documentation so someone can install it, import it, and understand how to use it quickly. Look up current TypeScript decorator docs online if needed.

Want more depth? Deep Reverse