Changes

v0.2

  • Added not_empty_list rule with test cases

v0.3

  • Added filter rule "trim"
  • Added filter rule "to_lc"
  • Added filter rule "to_uc"

v0.4

  • Added special rules (url, iso_date)
  • Added filter rules (remove, leave_only)
  • Add flags 'i' flag support to the "like" rule
  • Introduces new syntax for "one_of" and "list_of" rules. (See "Syntax changes for 'one_of' and 'list_of' rules")
  • Rules aliasing (with custom errors)

v2.0

  • Switched to semver. 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, just modify data.
  • "Helper rules" renamed to "Metarules" as this 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"
  • Add more edge cases to test suite
  • Add experimental status to the "like" rule

Syntax changes for 'one_of' and 'list_of' rules

Old syntax {one_of: [['val1', 'val2']]} was hard to remember for many people. The idea was that list of allowed values should be passed as array reference. So, {one_of: [['val1', 'val2']]} becomes one_of(['val1', 'val2']) but it is not always clear for users. Therefore, it was decided to introduce a new syntax. Now you can write {one_of: ['val1', 'val2']} that becomes one_of('val1', 'val2'). The main problem with it that you do not know how many arguments will be passed to 'one_of'. Moreover, you should support both syntaxes for backward compatibility (test suite contains tests for both cases). But it was decided that "one_of" and "list_of" rules can handle both syntaxes by themselves.

TODO

  • Add JSON Schema comparison
  • Describe internals with detailed step-by-step example
  • Write developers guide

results matching ""

    No results matching ""