reyesoft / ngx-jsonapi

JSON API client library for Angular 5+ 👌 :: Production Ready 🚀
https://ngx-jsonapi.reyesoft.com/
MIT License
101 stars 52 forks source link

Cannot parse relationship data into Resource because of different between `type` and relationship key #319

Closed pandabamboo90 closed 3 years ago

pandabamboo90 commented 3 years ago

I have following resources setup in my project, User & Role, their relationship is 1-N

User

Screen Shot 2021-06-18 at 02 36 33

Role

Screen Shot 2021-06-18 at 02 36 45

API response

Screen Shot 2021-06-18 at 02 34 38

Issue

As you can see in the source code, I specific the relationship key is pluralize roles, but the type is role.

The Role resource cannot be parse with this config, I think it might be related to the different between type and relationship key in the Resource class.

Please help !

pandabamboo90 commented 3 years ago

Look like we need to register the relationship service (even if we dont use it in our code) in component as mentioned here #193