Hi,
The atomic_operations.prasers.AtomicOperationParser parser does not support removal of many-to-many relationships, as described in the Atomic Operations documentation:
POST /operations HTTP/1.1
Host: example.org
Content-Type: application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"
Accept: application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"
{
"atomic:operations": [{
"op": "remove",
"ref": {
"type": "articles",
"id": "1",
"relationship": "comments"
},
"data": [
{ "type": "comments", "id": "12" },
{ "type": "comments", "id": "13" }
]
}]
}
If the op code is remove and you provide both ref and data keys in the operation document, and the latter is associated with a list, the parser then treats that value as a dict and attempts to read the type key from it, resulting in an exception.
The issue is related to this code:
|
resource_identifier_object=operation.get( |
|
"data", operation.get("ref") |
|
), |
...where
ref is only read as a fallback, if
data is not found.
This causes this line to fail:
|
parsed_data["type"] = resource_identifier_object.get("type") |
Hi,
The
atomic_operations.prasers.AtomicOperationParserparser does not support removal of many-to-many relationships, as described in the Atomic Operations documentation:If the
opcode isremoveand you provide bothrefanddatakeys in the operation document, and the latter is associated with a list, the parser then treats that value as a dict and attempts to read thetypekey from it, resulting in an exception.The issue is related to this code:
drf-json-api-atomic-operations/atomic_operations/parsers.py
Lines 228 to 230 in 734cd7c
...where
refis only read as a fallback, ifdatais not found.This causes this line to fail:
drf-json-api-atomic-operations/atomic_operations/parsers.py
Line 168 in 734cd7c