Skip to content

Conversation

@agarzola
Copy link
Member

@agarzola agarzola commented Aug 31, 2018

As outlined in #9, json:api allows fetching a related object via /:type/:id/:field_name and 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.

@agarzola agarzola added the work in progress This is still a work in progress and should not be merged. label Aug 31, 2018
@@ -0,0 +1,12 @@
module.exports = {
type: 'blockquote',
id: '104',
Copy link
Member Author

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.

Copy link
Member Author

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.

@agarzola agarzola mentioned this pull request Sep 2, 2018
3 tasks
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
@agarzola agarzola force-pushed the feature/fetch-rels-in-parallel branch from 254ebe0 to 6e02914 Compare September 12, 2018 17:44
@agarzola agarzola removed the work in progress This is still a work in progress and should not be merged. label Oct 16, 2018
@adamzimmermann
Copy link

👍 talked through this with @agarzola and all of the changes look good to me.

@agarzola agarzola merged commit e903aa6 into master Nov 9, 2018
@agarzola agarzola deleted the feature/fetch-rels-in-parallel branch November 9, 2018 14:17
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.

4 participants