2.2.0 • Published 9 months ago

@galaxyops/validation-schemas v2.2.0

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

@galaxyops/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 '@galaxyops/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 @galaxyops/faker-factory enabling automatic generation of fakes.

References