0.4.8 • Published 2 months ago

@cats-cradle/validation-schemas v0.4.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@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.

References