loopback-component-jsonapi icon indicating copy to clipboard operation
loopback-component-jsonapi copied to clipboard

Feature/multi level includes

Open Tronix117 opened this issue 7 years ago • 5 comments

This PR allows to have nested includes.

Exemple:

GET /posts/1?filter[include][comments]=author

will retrieve all comments, as well as the author of each comments


I also removed the unecessary "requestedIncludes" option.

This option should not handle the way this adapter serialize the resources, if there is embedded resources, even if they do not appear in this option, recommended behavior is to have them in the include property as well.

Security consideration: nested includes were previously not handled, it is now the case, like in the loopback documentation, users need to ensure it is secured their side, like they do when using loopback without JSONApi.

Tronix117 avatar Aug 21 '18 12:08 Tronix117

Coverage Status

Coverage increased (+0.4%) to 94.911% when pulling dc36ee0fe6723499376d9ec38ebc0ae1061d5c06 on Tronix117:feature/multi-level-includes into 40f928273fe50acfebb11cbaf2e0469f0d56efea on digitalsadhu:master.

coveralls avatar Aug 21 '18 12:08 coveralls

@digitalsadhu some feedback ?

Tronix117 avatar Sep 20 '18 13:09 Tronix117

if you make a call with relationship like:

GET /company-users/{id}/user

and that the ressource linked don't existe we have a error. Should be catch it. TypeError: Cannot read property 'relationships' of null\n at /loopback-component-jsonapi/lib/serializer.js:373:18

Leito987 avatar Oct 10 '18 14:10 Leito987

@Tronix117 I'm afraid I don't have time to get my head back into this project. I'm thinking also with the new version of Loopback being a very major breaking change this project might naturally reach an end of life before too long as I won't be attempting to port anything. I'm happy for you to merge PRs as you see fit and continue maintenance if you have the time.

digitalsadhu avatar Oct 26 '18 08:10 digitalsadhu

That’s what I though, from our side we are using it on a big production project and forme time to time we have some evolutions to push. I will do what you say, is npm publishing also fully automatic ?

Tronix117 avatar Oct 26 '18 11:10 Tronix117