-
-
Notifications
You must be signed in to change notification settings - Fork 745
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
Updating a document with a data_relation that is nullable fails #1159
Comments
Excellent, thank you. |
For those folks that have this issue and don't want to wait for a fix, I temporarily solved it by extending the validator and overriding the _validate_data_relation like so.... class MyValidator(Validator):
def _validate_data_relation(self, relation, field, value):
""" {'type': 'dict',
'schema': {
'resource': {'type': 'string', 'required': True},
'field': {'type': 'string', 'required': True},
'embeddable': {'type': 'boolean', 'default': False},
'version': {'type': 'boolean', 'default': False}
}} """
if value:
super(C2M2validator, self)._validate_data_relation(
relation, field, value
)
# def _validate_data_relation |
Should be fixed now! |
I'm having the same error and it still doesn't work even with Eve eb6d37d. I'm sending the ref in JSON with value null, so probably the conversion from null to None doesn't work properly. |
@Kobzol can't reproduce it. Sending a
|
PS: if I switch back to v0.8 (current stable), I get a 422 as reported and expected |
Sorry, I guess that I didn't update the version correctly using pip, I tried it with a clean clone and now it works. Thank you very much. |
Expected Behavior
Given a schema that defines a data_relation but also marks the field as "nullable", one would expect that setting the field to "None" would be legal.
Actual Behavior
Instead, eve generates an error saying: "value 'None' must exist in resource 'companies', field '_id'."
Environment
The text was updated successfully, but these errors were encountered: