1

I am using Cerberus with default and custom validation rules.

My raw data can include empty values and this is causing them to be skipped from any validation, whereas I would like to be able to check them against other values and produce a custom error message: "x value not equal to y value".

From Cerberus: Cerberus docs - empty

Per default the emptiness of a field isn’t checked and is therefore allowed when the rule isn’t defined. 

How can I "force" Cerberus to accept empty values and to use the empty value to see if it validates against all other rules.

Schema example:

"columns":{
    "foobar":{
      "type":"string",
      "minlength":6,
      "maxlength":6,
      "my_custom_rule": {
        "value_to_check_against": "foo-bar"
      },
      "meta": {
        "foo_bar":"FOOBAR"
      }
    }

Any ideas? I've used a combinations of "empty", "nullable" but it doesn't produce the results I need.

Lev
  • 673
  • 1
  • 12
  • 29

0 Answers0