For some reason validation of fields in partial updates wasn't
triggered. Investigating I found that in the case of partial updates
every field is marked as not-required when constructing the serializer:
rest_framework/fields.py:173
if self.partial:
self.required = False
but I couldn't a find where the place (if such a place exists) where the
fields that came in the PATCH request are marked as required again in
order to trigger their validation.
Basically this hotfix does that, mark as required every field present in
the PATCH request so their validation is performed.
The response for an UserStory/Issue now contains:
{
...
"neighbors": {
"previous": {
"id": ...,
"ref": ...,
"subject": ...
},
"next": {
... same as above
}
}
}
If there's a neighbor missing the response will contain the empty dict {}:
{
...
"neighbors": {
"previous": {},
...
}
}
Neighbors are looked up applying the same filters defined in the
corresponding ViewSets and the same ordering defined in those filters or
ultimately, in the model's meta. In other words, using the same params
you use to filter the object list, can be used to filter the neighbors
when fetching the object's details.