-
Notifications
You must be signed in to change notification settings - Fork 1
Fetch relationships in parallel #13
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
Conversation
| @@ -0,0 +1,12 @@ | |||
| module.exports = { | |||
| type: 'blockquote', | |||
| id: '104', | |||
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.
Ideally, in the future, both the type and the id would be omitted from these files. The mocking module would insert these values automatically by convention. That would help make things just a bit DRYer.
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.
Update: this whole json:api mocking function has been extracted into jsonapilite (named after sqlite) and expanded a bit to support the needs of #14. That extraction occurs in the branch for #14, which is based off of this branch.
This is missing test data for the field and relationship endpoints, and will likely require a refactor of test data to break things apart.
And remove unused tests
254ebe0 to
6e02914
Compare
|
👍 talked through this with @agarzola and all of the changes look good to me. |
As outlined in #9,
json:apiallows fetching a related object via/:type/:id/:field_nameand the relationship itself via/:type/:id/relationships/:field_name. This PR implements optionally fetching related objects and relationships using these endpoints via parallel requests.In order to test this, I needed to mock up fetching these smaller subsets of data, so the rudimentary JSON file would not cut it. An API mocking function takes a request object and uses the file system to construct a
json:api-compliant response. It supports relationships via query string parameters and via the URLs specified above.This is best reviewed on a per-commit basis.