-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON-API serialisation failure due to resource hash with nested data key #3381
Comments
@john-griffin could your share an example of your payload? |
@bmac here is a sample of the response {
"data": {
"id": "29039571-e1f3-418c-8889-31b49951ad96",
"type": "users",
"links": {
"self": "https://www.example.com/api/v3/users/29039571-e1f3-418c-8889-31b49951ad96"
},
"attributes": {
"email": "foo@bar.com",
"first-name": "Foo",
"last-name": "Bar",
},
"relationships": {
"photo": {
"links": {
"self": "https://www.example.com/api/v3/users/29039571-e1f3-418c-8889-31b49951ad96/relationships/photo",
"related": "https://www.example.com/api/v3/users/29039571-e1f3-418c-8889-31b49951ad96/photo"
},
"data": {
"type": "photos",
"id": "c3412c5b-9666-413b-b6be-3c4f9988e6a5"
}
}
}
}
} |
Hi @john-griffin I tried to put together a jsbin using the sample response you provided and I was unable to reproduce the error. Do you mind taking a look at it and let me know what assumption I have wrong? Thanks. |
@bmac thanks for breaking that down in a jsbin. The only difference there was ember-data version. So I upgraded from |
For future reference: This was caused by the JSON-API adapter/serializer not opting into the new Serializer API by default. Was fixed by #3375 and in 1.13.3. |
See 76cf421#commitcomment-11749944
When fetching a JSON-API 1.0 compliant resource it fails because serializer expects data to be at the top level of the
resourceHash
when it is actually nested inresourceHash.data
.Might be fixable by ensuring
resourceHash.data
is passed through here? https://github.com/emberjs/data/blob/master/packages/ember-data/lib/serializers/json-api-serializer.js#L179The text was updated successfully, but these errors were encountered: