Closed (won't fix)
Project:
JSON:API
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Aug 2016 at 09:43 UTC
Updated:
6 Jun 2018 at 01:31 UTC
Jump to comment: Most recent
According with the spec, the fields type and id are protected and cannot appear in the attributes or the relationships. See: http://jsonapi.org/format/upcoming/#document-resource-object-fields
We do have type and id in our payloads.
Change the name of the property to a safe name. Suggestions are:
entity--type and entity--idresource--type and resource--idWhenever we need to do a field change, we should note that in the metadata for that object:
{
"type": "lorem--ipsum",
"id": 1234,
"attributes": {
"resource--type": "foo"
}
"meta": {
"fieldMaps": {
"resource--type": "type"
}
}
}
That way consumers may build a matching representation of the object in the backend with the correct field names.
Comments
Comment #2
e0ipsoComment #3
e0ipsoWhile this is important, I don't think it makes sense until we can have field aliases.
Comment #4
wim leersComment #5
e0ipsoClosing. Please continue discussion in #2846488: Explore abstracting away "Drupalisms".
Comment #6
alex.skrypnyk@e0ipso
I'm not sure why this was closed. Current implementation of `jsonapi` module responses is not compliant with JSONAPI standard. This has not thing to do with other improvements and field aliases. Currently, every installation of `jsonapi` module need to alter this to make the clients work correctly, because the clients expect standard-compliant JSONAPI responses.
Please consider re-opening this.
Comment #7
alex.skrypnyk