#1472·eve

422 UNPROCESSABLE ENTITY when using user_id and data_relation on PATCH

Author: xibrizCreated Mar 29, 2022Updated Aug 17, 2023

Expected Behavior: 200 OK

Actual Behavior: 422 UNPROCESSABLE ENTITY

If using set_request_auth_value on a schema and having defined a data_relation to a schema that is not using any auth value, a PATCH operation will fail with the follwoing error:

value 'XXX' must exist in resource 'YYY', field '_id'

POST works fine.

The only workaround is not to define any data_relation.

According to my research, the _filter variable contains the user_id in an $and condition when PATCH but not on POST.

https://github.com/pyeve/eve/blob/c62941992b2f66fa02b822581891bd7c18e76d9c/eve/io/mongo/mongo.py#L335

Environment

  • Python version: 3.8.10
  • Eve version: 1.1.5