angular2-jsonapi icon indicating copy to clipboard operation
angular2-jsonapi copied to clipboard

Library do not resolve relationships on infinite levels.

Open jopejuca opened this issue 8 years ago • 2 comments

There is a hard coded limit of 2 in the file json-api.model.js in the functions:

JsonApiModel.prototype.getHasManyRelationship and JsonApiModel.prototype.getBelongsToRelationship

in the line: if (level <= 1) {

I would suggest either change the documentation, that says:

"The library will try to resolve relationships on infinite levels connecting nested objects by reference. So that you can have a Post, with a list of Comments, that have a User that has Posts, that have Comments... etc."

Or implement a cycle detecting algorithm.

jopejuca avatar Sep 06 '17 05:09 jopejuca

Actually it works parsing infinite levels, connecting objects by reference as described. The limit of 1 is because otherwise it will enter in an infinite loop entering in all the reference. Check this commit: bd02e3a6c91831da0e4f484907c8077cf70888dd

ghidoz avatar Sep 06 '17 08:09 ghidoz

Is this still an issue?

HennerM avatar Sep 16 '17 19:09 HennerM