Skip to content

Add "tryValidate", "toJSON" method and "in" validation rule

Compare
Choose a tag to compare
@thetutlage thetutlage released this 02 Jun 12:36
· 7 commits to develop since this release

tryValidate

The tryValidate method can be used to perform validation without throwing a validation error. Instead, the errors are returned as the return value of the method, which is a tuple.

const [error, result] = validator.tryValidate({ data: {} })

The try prefix is inspired from the Java world.

in

The in validation rule has been added for the VineNumber schema type and can be used to ensure the value of field is part of the allowed values list.

toJSON

The validator.toJSON method can be used to get the validator and its refs as JSON.

Commits

  • feat: add tryValidate method to Vine (a70ff38)
  • feat: add tryValidate method (cebb8e0)
  • fix: add "in" rule in default number rules (#54) (39204e4)
  • chore: migrate to release-it (0b5e212)
  • feat: add in rule for number (#53) (72912af)
  • feat: export modifiers (#48) (34e07fc)
  • chore: update dependencies (a7e18b7)
  • style: reformat codebase (62d450c)
  • feat: add validator.toJSON method to get compiled schema and refs (5259933)

What's Changed

New Contributors

Full Changelog: v2.0.0...v2.1.0