@cats-cradle/validation-schemas
v2.1.0
Published
Contains standard class-validator decorators and custom decorators for use primarily in defining and validating data used in game design.
Downloads
42
Readme
@cats-cradle/validation-schemas
Contains standard class-validator decorators and custom decorators for use primarily in defining and validating data used in game design.
import {
validateSync,
ValidationError,
IsDiceNotation,
} from '@cats-cradle/validation-schemas';
class Turn {
@IsDiceNotation()
public diceNotation: string;
}
let turn = new Turn();
turn.diceNotation = '1d6+4';
const errors: ValidationError[] = validateSync(testClass);
// outputs 0
console.log(errors.length);
All validation decorators should be supported by @cats-cradle/faker-factory enabling automatic generation of fakes.