New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NotImplementedError when accessing validator errors while using oneof list of dict #299
Comments
see #278 |
Same issue here! Can be reproduced using: import cerberus
generic_message_schema = {
b"t": {"type": "binary", "empty": False, "required": True},
}
common_response_schema = {
b"y": {"type": "binary", "allowed": [b"r"], "required": True}
}
common_response_arguments_schema = {
b"id": {"type": "binary", "minlength": 20, "maxlength": 20, "required": True}
}
get_peers_response_schema = {
**generic_message_schema,
**common_response_schema,
b"r": {"required": True, "schema": {
**common_response_arguments_schema,
b"token": {"type": "binary", "empty": False, "required": True},
b"values": {"type": "list", "excludes": b"nodes", "required": True, "schema": {
"type": "bytes",
"minlength": 6, "maxlength": 6
}},
b"nodes": {"type": "binary", "excludes": b"values", "required": True, "minlength": 26,
"maxlength": 8 * 26}
}}
}
print(">>>", cerberus.Validator().validate({}, get_peers_response_schema))
|
kornholi
pushed a commit
to kornholi/cerberus
that referenced
this issue
Jun 28, 2017
Any chance of the fix for this being released soon? I'm hitting exactly this error in what is really a perfect use case for a one-of rule, and am struggling to figure out a way to refactor my schema to avoid it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use-case abstract
When I run the following snippet, using the
1.1
version, I get aNotImplementedError
In this example, the problem is that
a
is supposed to be adict
. Instead, astring
was found.Support request
After looking into the code, I found out it's due to following section in the
insert_logic_error
method of theBasicErrorHandler
.Replacing it with the next snippet fixes my problem without breaking any of the existing tests of the project.
But I guess this behavior is not an accident and there's a reason for the
NotImplementedError
being there. Am I missing something?The text was updated successfully, but these errors were encountered: