We've noticed that field name overrides are not being respected when issuing PATCH requests against the API when updating content. For example:
If our data is NOT using field name overrides, we would update it with a PATCH request looking something like this:
{
"data": {
"type": "my_type",
"id": "84accc31-09f9-4c4e-bca2-511f5f0b0171",
"attributes": {
"name": "My Content",
"field_data_1": "Some updated text Content",
}
}
}
This updates correctly.
However, if we modify the field name - in this instance just removing the Drupalism of 'field_data_1' and calling the field 'data_1'....
{
"data": {
"type": "my_type",
"id": "84accc31-09f9-4c4e-bca2-511f5f0b0171",
"attributes": {
"name": "My Content",
"data_1": "Some updated text Content",
}
}
}
Sending this patch request returns an error:
"The provided field (data_1) does not exist in the entity with ID 84accc31-09f9-4c4e-bca2-511f5f0b0171."
Comments
Comment #2
mrjmd commentedIt's worth noting that POSTs seem to work fine.
Comment #3
e0ipsoHmm this may be a bug in
jsonapithen. The parent is not triggering the field name translation?Comment #4
logickal commentedYes, it's probably worth noting that the stack trace starts at jsonapi/src/Controller/EntityResource.php:219.
EDITED: Line number from stack trace, wrong copy paste.
Comment #5
logickal commentedDefinitely applied to jsonapi - closing this issue to open in the appropriate place.