{"repo":"typestack/class-validator","free":true,"listed":false,"github":"https://github.com/typestack/class-validator","clone":"git clone https://github.com/typestack/class-validator.git","description":"Decorator-based property validation for classes.","language":"TypeScript","stars":11824,"topics":["validation","validator","decorators","typescript"],"license":"MIT","category":"dev-tools","readme_excerpt":"class-validator Allows use of decorator and non-decorator based validation. Internally uses [validator.js][1] to perform validation. Class-validator works on both browser and node.js platforms. Table of Contents - class-validator - Table of Contents - Installation - Usage - Passing options - Validation errors - Validation messages - Validating arrays - Validating sets - Validating maps - Validating nested objects - Validating promises - Inheriting Validation decorators - Conditional validation - Whitelisting - Passing context to decorators - Skipping missing properties - Validation groups - Custom validation classes - Custom validation decorators - Using service container - Synchronous validation - Manual validation - Validation decorators - Defining validation schema without decorators - Validating plain objects - Samples - Extensions - Release notes - Contributing Installation Note: Please use at least npm@6 when using class-validator. From npm@6 the dependency tree is flattened, which is required by class-validator to function properly. Usage Create your class and put some validation decorators on the properties you want to validate: Passing options The validate function optionally expects a ValidatorOptions object as a second parameter: IMPORTANT The forbidUnknownValues value is set to true by default and it is highly advised to keep the default . Setting it to false will result unknown objects passing the validation! Validation errors The validate method returns an array","default_branch":null,"files":null,"tree":[],"storefront":"/r/typestack","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/typestack/class-validator/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}