-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find and inflate unpopulated resources returned to api-client [P4-2337] #981
Conversation
e47c31f
to
222bb23
Compare
222bb23
to
2193a66
Compare
2193a66
to
275bc2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to jump on a call Monday morning just to try and understand the purpose of this change a little better.
It feels like this is overriding some, possibly quite specific, functionality within the JSON:API client library and I'm a little worried about whether this might have knock-on effects elsewhere within the application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As raised during our calls, I have concerns about this change as it changes the behaviour with the way the API client handles deserialisation and could lead to some unexpected side-effects/uneasy debugging.
Can we please add a GH issue to our backlog to get this removed once the API correctly supports includes.
Some backend endpoints do not allow for the retrieval of resources using includes. Devour sets any resource referenced as a relationship but not present in the included section to null. Modifications to `common/lib/api-client/middleware/request.js` and `common/lib/api-client/middleware/process-response.js` allow for minimal resource stubs to be added to the included section. `common/lib/find-unpopulated-resources.js` allows for the detection of unpopulated resources in any data structure passed to it `common/lib/populate-resources.js` allows for the inflation of any unpopulated resources in any data structure passed to it
275bc2c
to
d033aaf
Compare
Code Climate has analyzed commit d033aaf and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (90% is the threshold). This pull request will bring the total coverage in the repository to 97.9% (0.1% change). View more on Code Climate. |
Proposed changes
What changed
Modifications to
common/lib/api-client/middleware/request.js
andcommon/lib/api-client/middleware/process-response.js
allow for minimal resource stubs to be added to the included section.common/lib/find-unpopulated-resources.js
allows for the detection of unpopulated resources in any data structure passed to itcommon/lib/populate-resources.js
allows for the inflation of any unpopulated resources in any data structure passed to itWhy did it change
Some backend endpoints do not allow for the retrieval of resources using includes.
Devour sets any resource referenced as a relationship but not present in the included section to null.
Issue tracking
Screenshots
n/a
Checklists
Testing
Automated testing
Manual testing
Has been tested in the following browsers:
Environment variables
Other considerations