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

Missing relationship data for included relationship

Open beauby opened this issue 9 years ago • 3 comments

Other bug: when serializing a Post, and including comments, comments.post, comments.post.author, the author relationship of the primary post does not get populated, though comments.post refers to the primary post.

More generally, I believe there is an undefined behavior when a related resource can be reached via multiple relationship paths.

beauby avatar Dec 12 '16 01:12 beauby

https://github.com/fotinakis/jsonapi-serializers/blob/master/lib/jsonapi-serializers/serializer.rb#L115 https://github.com/fotinakis/jsonapi-serializers/blob/master/lib/jsonapi-serializers/serializer.rb#L150

I see an issue in these lines: lets take an example above /get/posts?include=comment.author

in lines above default inslude_data is false and @_include_linkages never has comment match

this means that you will have list of posts and included list of comments but without data block and you cannot match them on client

ababich avatar Feb 28 '17 20:02 ababich

My immediate impression is that include_data should be defaulted to true, why not?

ababich avatar Feb 28 '17 20:02 ababich

@ababich I believe your are referring to a different issue (namely that of full-linkage being incidentally broken by relationships' include data being omitted).

beauby avatar Mar 02 '17 08:03 beauby