Skip to content

Changelog ​

v2.0 ​

  • Switched to semver. The new release version is 2.0.
  • Unified approach to types handling.
  • "Base rules" renamed to "Common rules".
  • "Filter rules" renamed to "Modifiers". They do not validate anything, they just modify data.
  • "Helper rules" renamed to "Metarules", as these rules are for describing other rules.
  • Added common rule any_object.
  • Added string rule string.
  • Added string rule eq.
  • Added metarule variable_object.
  • Added metarule or.
  • Added modifier default.
  • Added more edge cases to the test suite.
  • Marked the like rule as experimental.

v0.4 ​

v0.3 ​

  • Added filter rule trim.
  • Added filter rule to_lc.
  • Added filter rule to_uc.

v0.2 ​

Syntax changes for one_of and list_of rules ​

The old syntax { one_of: [['val1', 'val2']] } was hard to remember for many people. The idea was that the list of allowed values is passed as a single array argument: { one_of: [['val1', 'val2']] } becomes one_of(['val1', 'val2']). But that is not obvious for users.

So a new syntax was introduced: { one_of: ['val1', 'val2'] } becomes one_of('val1', 'val2'). The problem is that you do not know how many arguments will be passed to one_of, and both syntaxes must be supported for backward compatibility (the test suite covers both). It was decided that the one_of and list_of rules handle both syntaxes by themselves.

Documentation TODO ​

  • Describe the internals with a detailed step-by-step example.
  • Write a developers guide.