ChromaticHQ / jsonmonger

23 stars 1 forks source link

Fetch relationships in parallel #13

Closed agarzola closed 5 years ago

agarzola commented 6 years ago

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.

adamzimmermann commented 5 years ago

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