You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cerberus 1.3 deprecates keyschema and valueschema in favor of keysrules and valuesrules. It also modifies any schema passed to it to rename the deprecated names with the corresponding new names.
However, Eve still uses valueschema in eve.methods.common.serialize (eve/methods/common.py line 523) and doesn't look for valuesrules. This means that if the domain configuration contains a valuesrules (or valueschema - it doesn't matter, because Cerberus renames them) with a type that requires conversion (such as datetime, for instance), that conversion will not happen.
Unfortunately, downgrading to Cerberus 1.2 is not an option for me, as it doesn't work in Python 3.11.
Expected Behavior
The following minimal example program and request should successfully insert a new document in the "example" collection:
Eve does not convert the strings to datetime before passing them on to validation, as it would if the "type": "datetime" were not inside valuesrules. The request then fails with:
{"_status": "ERR", "_issues": {"field1": {"a": "must be of datetime type"}, "field2": {"a": "must be of datetime type"}}, "_error": {"code": 422, "message": "Insertion failure: 1 document(s) contain(s) error(s)"}}
Environment
Python version: 3.11
Eve version: 2.1.0
The text was updated successfully, but these errors were encountered:
Cerberus 1.3 deprecates
keyschema
andvalueschema
in favor ofkeysrules
andvaluesrules
. It also modifies any schema passed to it to rename the deprecated names with the corresponding new names.However, Eve still uses
valueschema
ineve.methods.common.serialize
(eve/methods/common.py line 523) and doesn't look forvaluesrules
. This means that if the domain configuration contains avaluesrules
(orvalueschema
- it doesn't matter, because Cerberus renames them) with atype
that requires conversion (such asdatetime
, for instance), that conversion will not happen.Unfortunately, downgrading to Cerberus 1.2 is not an option for me, as it doesn't work in Python 3.11.
Expected Behavior
The following minimal example program and request should successfully insert a new document in the "example" collection:
Actual Behavior
Eve does not convert the strings to
datetime
before passing them on to validation, as it would if the"type": "datetime"
were not insidevaluesrules
. The request then fails with:Environment
The text was updated successfully, but these errors were encountered: