Skip to content

Conversation

annervisser
Copy link

When a certain resource is included in the response and is a relation for multiple resources, it is only included in the angular2-jsonapi models once.

To explain I've created a test that fails on the current master branch, and is resolved in my fix.
I've added a category entity, which represents the category of a book.
If I request an author, with include=books.category.books, the following is happens:

  • author.books is correctly set
  • author.books.category is correctly set
  • author.books.category.books is undefined

This is caused by methods getBelongsToRelationship and getHasManyRelationship. They look for the relationship in the remainingModels array where they should be looking in the included array.

@annervisser annervisser marked this pull request as ready for review April 2, 2019 13:39
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 91.572% when pulling a7b54fd on blockcounter:included-parsing-bug into f3f809f on ghidoz:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 91.572% when pulling a7b54fd on blockcounter:included-parsing-bug into f3f809f on ghidoz:master.

@safo6m safo6m merged commit 20a7790 into ghidoz:master Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants