problem with nested serialization
I have nested object like user.UserBalances[0].Type for serialization
module.exports = {
attributes: ['name', 'UserBalances'],
UserBalances: {
ref: 'id',
included: true,
attributes: ['user_id', 'Type'],
Type: {
ref: 'id',
included: true,
attributes: ['title']
}
}
All works fine except 3 level Type.
This is expected behavior, bug or I'm doing something wrong
@zion03 can you share me the "data input", the current "data output" and the expected result? Thanks!
@SeyZ, @zion03 meant he wants to serialize nested relationships. The result of serialization should be like that:
{
"data": {
"type": "category",
"id": "5715e6649a892006ae7224f7",
"attributes": {
"name": "Category name"
},
"relationships": {
"article": {
"data": {
"type": "article",
"id": "56fab7f59a8920070e34bec8"
}
}
}
},
"included": [
{
"type": "article",
"id": "56fab7f59a8920070e34bec8",
"attributes": {
"name": "Article name"
},
"relationships": {
"author": {
"data": {
"type": "author",
"id": "56f90cf59a8920070e34bec7"
}
},
"editor": {
"data": {
"type": "editor",
"id": "56f93a469a8920070d466517"
}
}
}
},
{
"type": "author",
"id": "56f90cf59a8920070e34bec7",
"attributes": {
"name": "MyName"
}
},
{
"type": "editor",
"id": "56f93a469a8920070d466517",
"attributes": {
"name": "MyName"
}
}
]
}
Could your library serialize nested relationships?
@SeyZ, As I understood more then 2 level of nested relationships are not supported. Am I right?
@devdemi According to the examples within the test examples here, the examples starting from line 984 show there is support for nested relationships. However I'm running into the same issues as @zion03 where the nested information is not being serialised into the top level included attribute.
Any news on this? I just ran into the same problem...
Yes, it seems more than two levels of relationships not working properly. Is there any solution?
Any update on this?
Also interested in a solution to this 👍
I got this working with Mongoose 🎉
@ynnoj could you enlighten us as to how you got it working?
Probably this issue is related to #159 . I have the same issue when passing data from Objection because nested objects there are not "plain."