devour-client
devour-client copied to clipboard
Including recursive relationships result in null object
Including recursive relationships result in a null object.
A minimal example is here: Backend Frontend
As you see from the response of the API, jsonApi.findAll("a", { include: "b.a" }) should return an array with a objects that have an array with b objects which contain an a object. (Sorry for my poor English skills that can't explain it better than this.) However, the b objects' a field are always null, instead of the object.
For example, I would expect such output:
{
"data": [
{
"id": "PpupN/bi1Eo8KtT/uHvm",
"type": "as",
"b": [],
"links": {
"self": "/as/PpupN%2Fbi1Eo8KtT%2FuHvm"
}
},
{
"id": "Ju6gn8yvL63rTN5Cr1zU",
"type": "as",
"b": [
{
"id": "Z5ygOhd6cHqz1jU09maF",
"type": "bs",
"a": {
"id": "Ju6gn8yvL63rTN5Cr1zU",
"type": "as",
"b": [],
"links": {
"self": "/as/Ju6gn8yvL63rTN5Cr1zU"
}
},
"links": {
"self": "/bs/Z5ygOhd6cHqz1jU09maF"
}
}
],
"links": {
"self": "/as/Ju6gn8yvL63rTN5Cr1zU"
}
},
{
"id": "WFduHuyXYmkg6k6BCb+o",
"type": "as",
"b": [
{
"id": "PoFSsKpm6ZaTkaaoj1Ln",
"type": "bs",
"a": {
"id": "WFduHuyXYmkg6k6BCb+o",
"type": "as",
"b": [],
"links": {
"self": "/as/WFduHuyXYmkg6k6BCb%2Bo"
}
},
"links": {
"self": "/bs/PoFSsKpm6ZaTkaaoj1Ln"
}
},
{
"id": "GLZwIT3E5p0dYzHD0l8z",
"type": "bs",
"a": {
"id": "WFduHuyXYmkg6k6BCb+o",
"type": "as",
"b": [],
"links": {
"self": "/as/WFduHuyXYmkg6k6BCb%2Bo"
}
},
"links": {
"self": "/bs/GLZwIT3E5p0dYzHD0l8z"
}
}
],
"links": {
"self": "/as/WFduHuyXYmkg6k6BCb%2Bo"
}
}
],
"meta": {
"count": 3
},
"links": {
"self": "/as?include=b.a"
}
}
However the current output is this:
{
"data": [
{
"id": "PpupN/bi1Eo8KtT/uHvm",
"type": "as",
"b": [],
"links": {
"self": "/as/PpupN%2Fbi1Eo8KtT%2FuHvm"
}
},
{
"id": "Ju6gn8yvL63rTN5Cr1zU",
"type": "as",
"b": [
{
"id": "Z5ygOhd6cHqz1jU09maF",
"type": "bs",
"a": null,
"links": {
"self": "/bs/Z5ygOhd6cHqz1jU09maF"
}
}
],
"links": {
"self": "/as/Ju6gn8yvL63rTN5Cr1zU"
}
},
{
"id": "WFduHuyXYmkg6k6BCb+o",
"type": "as",
"b": [
{
"id": "PoFSsKpm6ZaTkaaoj1Ln",
"type": "bs",
"a": null,
"links": {
"self": "/bs/PoFSsKpm6ZaTkaaoj1Ln"
}
},
{
"id": "GLZwIT3E5p0dYzHD0l8z",
"type": "bs",
"a": null,
"links": {
"self": "/bs/GLZwIT3E5p0dYzHD0l8z"
}
}
],
"links": {
"self": "/as/WFduHuyXYmkg6k6BCb%2Bo"
}
}
],
"meta": {
"count": 3
},
"links": {
"self": "/as?include=b.a"
}
}