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.
### Given the following schema....
USER_SCHEMA = {
'email': {
'type': 'string',
'minlength': 1,
'maxlength': 254,
'required': True,
'unique': True,
},
'name': {
'type': 'string',
},
'title': {
'type': 'string',
},
employer: {
'type': 'objectid',
'required': False,
'nullable': True,
'data_relation': {
'resource': 'company,
'field': '_id',
'embeddable': True
},
}
}
#### The following patch will fail but should succeed.
def test_patch_user():
payload = {'employer': None}
patch_header = {
'Authorization': TOKEN1['Authorization'],
'If-Match': user_etag
}
req = requests.patch(BASE_URL + '/users/' + user_id,
headers=patch_header, json=payload)
assert req.status_code == 200
Actual Behavior
Instead, eve generates an error saying: "value 'None' must exist in resource 'companies', field '_id'."
Environment
- Python version: 3.6.5
- Eve version: 0.8
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