Skip to content

bug: Duplicated models from includes are removed from response #89

@EspadaV8

Description

@EspadaV8

The title here is a probably a little off, but I can't think of a nicer way to explain it. We were using v1.9.1 and tried to update to v2.1.0 and one of our tests started failing and it looks like both v1 and v2 have different but semi-related issues.

Our test did a long include along the lines of (it isn't the same but the actual request wouldn't make sense with a lot more background knowledge)

group/list?include=people.comments.person.comments.person.photos

The include works fine and fetches a bunch of people and comments and a few photos, however, with v1 if a person has both comments and photos returned there would be 2 objects within the included array 1 with a relationship for comments and another with a relationship for photos. This clearly breaks the JSON-API standard since there are 2 objects in includes both with the same id (and this is what our test was checking for, an oversight when writing the test).

In v2 this behaviour changes and correctly sees that there are 2 objects with the same id and so only adds one to the includes. However, the relationships are not combined so now we have some missing photos relationships that should've been part of the response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions