Can be surprisingly expensive due to the naive implementation of inclusions which simply follows (many) related
links. We can group a lot of these requests together and drastically reduce the complexity.
$ DEBUG=jsonApi:* ./node_modules/.bin/mocha ./test/get-\:resource.js
...
jsonApi:validation:input {"type":"articles","include":"author.photos,photos"} +21ms
jsonApi:handler:search {"type":"articles","include":"author.photos,photos"} +1ms [null,[{"id":"de305d54-75b4-431b-adb2-eb6b9e546014","type":"articles","title":"NodeJS Best Practices","content":"na","author":{"type":"people","id":"cc5cca2e-0dd8-4b95-8cfc-a11230e73116","meta":{"updated":"2010-11-06"}},"tags":[{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[],"comments":[{"type":"comments","id":"3f1a89c2-eb85-4799-a048-6735db24b7eb"}],"meta":{"updated":"2011-05-10"}},{"id":"1be0913c-3c25-4261-98f1-e41174025ed5","type":"articles","title":"Linux Rocks","content":"na","author":{"type":"people","id":"d850ea75-4427-4f81-8595-039990aeede5"},"tags":[{"type":"tags","id":"2a3bdea4-a889-480d-b886-104498c86f69"}],"photos":[{"type":"photos","id":"aab14844-97e7-401c-98c8-0bd5ec922d93"},{"type":"photos","id":"72695cbd-e9ef-44f6-85e0-0dbc06a269e8"}],"comments":[]},{"id":"d850ea75-4427-4f81-8595-039990aeede5","type":"articles","title":"How to AWS","content":"na","author":{"type":"people","id":"32fb0105-acaa-4adb-9ec4-8b49633695e1"},"tags":[{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[{"type":"photos","id":"aab14844-97e7-401c-98c8-0bd5ec922d93"}],"comments":[]},{"id":"fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5","type":"articles","title":"Tea for Beginners","content":"na","author":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"},"tags":[{"type":"tags","id":"6ec62f6d-9f82-40c5-b4f4-279ed1765492"},{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[{"type":"photos","id":"4a8acd65-78bb-4020-b9eb-2d058a86a2a0"}],"comments":[{"type":"comments","id":"6b017640-827c-4d50-8dcc-79d766abb408"}]}]]
jsonApi:validation:output {"id":"de305d54-75b4-431b-adb2-eb6b9e546014","type":"articles","title":"NodeJS Best Practices","content":"na","author":{"type":"people","id":"cc5cca2e-0dd8-4b95-8cfc-a11230e73116","meta":{"updated":"2010-11-06"}},"tags":[{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[],"comments":[{"type":"comments","id":"3f1a89c2-eb85-4799-a048-6735db24b7eb"}],"meta":{"updated":"2011-05-10"}} +2ms
jsonApi:validation:output {"id":"1be0913c-3c25-4261-98f1-e41174025ed5","type":"articles","title":"Linux Rocks","content":"na","author":{"type":"people","id":"d850ea75-4427-4f81-8595-039990aeede5"},"tags":[{"type":"tags","id":"2a3bdea4-a889-480d-b886-104498c86f69"}],"photos":[{"type":"photos","id":"aab14844-97e7-401c-98c8-0bd5ec922d93"},{"type":"photos","id":"72695cbd-e9ef-44f6-85e0-0dbc06a269e8"}],"comments":[]} +0ms
jsonApi:validation:output {"id":"d850ea75-4427-4f81-8595-039990aeede5","type":"articles","title":"How to AWS","content":"na","author":{"type":"people","id":"32fb0105-acaa-4adb-9ec4-8b49633695e1"},"tags":[{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[{"type":"photos","id":"aab14844-97e7-401c-98c8-0bd5ec922d93"}],"comments":[]} +1ms
jsonApi:validation:output {"id":"fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5","type":"articles","title":"Tea for Beginners","content":"na","author":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"},"tags":[{"type":"tags","id":"6ec62f6d-9f82-40c5-b4f4-279ed1765492"},{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[{"type":"photos","id":"4a8acd65-78bb-4020-b9eb-2d058a86a2a0"}],"comments":[{"type":"comments","id":"6b017640-827c-4d50-8dcc-79d766abb408"}]} +0ms
jsonApi:include http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/author?& +1ms
jsonApi:include http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/photos?& +0ms
jsonApi:include http://localhost:16006/rest/articles/1be0913c-3c25-4261-98f1-e41174025ed5/author?& +1ms
jsonApi:include http://localhost:16006/rest/articles/1be0913c-3c25-4261-98f1-e41174025ed5/photos?& +0ms
jsonApi:include http://localhost:16006/rest/articles/d850ea75-4427-4f81-8595-039990aeede5/author?& +0ms
jsonApi:include http://localhost:16006/rest/articles/d850ea75-4427-4f81-8595-039990aeede5/photos?& +0ms
jsonApi:include http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/author?& +1ms
jsonApi:include http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/photos?& +0ms
jsonApi:handler:find {"type":"articles","id":"de305d54-75b4-431b-adb2-eb6b9e546014","relation":"author"} +6ms [null,{"id":"de305d54-75b4-431b-adb2-eb6b9e546014","type":"articles","title":"NodeJS Best Practices","content":"na","author":{"type":"people","id":"cc5cca2e-0dd8-4b95-8cfc-a11230e73116","meta":{"updated":"2010-11-06"}},"tags":[{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[],"comments":[{"type":"comments","id":"3f1a89c2-eb85-4799-a048-6735db24b7eb"}],"meta":{"updated":"2011-05-10"}}]
jsonApi:handler:find {"type":"articles","id":"de305d54-75b4-431b-adb2-eb6b9e546014","relation":"photos"} +0ms [null,{"id":"de305d54-75b4-431b-adb2-eb6b9e546014","type":"articles","title":"NodeJS Best Practices","content":"na","author":{"type":"people","id":"cc5cca2e-0dd8-4b95-8cfc-a11230e73116","meta":{"updated":"2010-11-06"}},"tags":[{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[],"comments":[{"type":"comments","id":"3f1a89c2-eb85-4799-a048-6735db24b7eb"}],"meta":{"updated":"2011-05-10"}}]
jsonApi:handler:find {"type":"articles","id":"1be0913c-3c25-4261-98f1-e41174025ed5","relation":"author"} +0ms [null,{"id":"1be0913c-3c25-4261-98f1-e41174025ed5","type":"articles","title":"Linux Rocks","content":"na","author":{"type":"people","id":"d850ea75-4427-4f81-8595-039990aeede5"},"tags":[{"type":"tags","id":"2a3bdea4-a889-480d-b886-104498c86f69"}],"photos":[{"type":"photos","id":"aab14844-97e7-401c-98c8-0bd5ec922d93"},{"type":"photos","id":"72695cbd-e9ef-44f6-85e0-0dbc06a269e8"}],"comments":[]}]
jsonApi:handler:find {"type":"articles","id":"1be0913c-3c25-4261-98f1-e41174025ed5","relation":"photos"} +0ms [null,{"id":"1be0913c-3c25-4261-98f1-e41174025ed5","type":"articles","title":"Linux Rocks","content":"na","author":{"type":"people","id":"d850ea75-4427-4f81-8595-039990aeede5"},"tags":[{"type":"tags","id":"2a3bdea4-a889-480d-b886-104498c86f69"}],"photos":[{"type":"photos","id":"aab14844-97e7-401c-98c8-0bd5ec922d93"},{"type":"photos","id":"72695cbd-e9ef-44f6-85e0-0dbc06a269e8"}],"comments":[]}]
jsonApi:handler:find {"type":"articles","id":"d850ea75-4427-4f81-8595-039990aeede5","relation":"author"} +0ms [null,{"id":"d850ea75-4427-4f81-8595-039990aeede5","type":"articles","title":"How to AWS","content":"na","author":{"type":"people","id":"32fb0105-acaa-4adb-9ec4-8b49633695e1"},"tags":[{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[{"type":"photos","id":"aab14844-97e7-401c-98c8-0bd5ec922d93"}],"comments":[]}]
jsonApi:handler:find {"type":"articles","id":"d850ea75-4427-4f81-8595-039990aeede5","relation":"photos"} +0ms [null,{"id":"d850ea75-4427-4f81-8595-039990aeede5","type":"articles","title":"How to AWS","content":"na","author":{"type":"people","id":"32fb0105-acaa-4adb-9ec4-8b49633695e1"},"tags":[{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[{"type":"photos","id":"aab14844-97e7-401c-98c8-0bd5ec922d93"}],"comments":[]}]
jsonApi:handler:find {"type":"articles","id":"fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5","relation":"author"} +0ms [null,{"id":"fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5","type":"articles","title":"Tea for Beginners","content":"na","author":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"},"tags":[{"type":"tags","id":"6ec62f6d-9f82-40c5-b4f4-279ed1765492"},{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[{"type":"photos","id":"4a8acd65-78bb-4020-b9eb-2d058a86a2a0"}],"comments":[{"type":"comments","id":"6b017640-827c-4d50-8dcc-79d766abb408"}]}]
jsonApi:handler:find {"type":"articles","id":"fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5","relation":"photos"} +0ms [null,{"id":"fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5","type":"articles","title":"Tea for Beginners","content":"na","author":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"},"tags":[{"type":"tags","id":"6ec62f6d-9f82-40c5-b4f4-279ed1765492"},{"type":"tags","id":"7541a4de-4986-4597-81b9-cf31b6762486"}],"photos":[{"type":"photos","id":"4a8acd65-78bb-4020-b9eb-2d058a86a2a0"}],"comments":[{"type":"comments","id":"6b017640-827c-4d50-8dcc-79d766abb408"}]}]
jsonApi:handler:find {"type":"people","id":"cc5cca2e-0dd8-4b95-8cfc-a11230e73116"} +7ms [null,{"id":"cc5cca2e-0dd8-4b95-8cfc-a11230e73116","type":"people","firstname":"Oli","lastname":"Rumbelow","email":"[email protected]"}]
jsonApi:handler:find {"type":"people","id":"d850ea75-4427-4f81-8595-039990aeede5"} +1ms [null,{"id":"d850ea75-4427-4f81-8595-039990aeede5","type":"people","firstname":"Mark","lastname":"Fermor","email":"[email protected]"}]
jsonApi:handler:find {"type":"photos","id":"aab14844-97e7-401c-98c8-0bd5ec922d93"} +0ms [null,{"id":"aab14844-97e7-401c-98c8-0bd5ec922d93","type":"photos","title":"Matrix Code","url":"http://www.example.com/foobar","height":1080,"width":1920,"photographer":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}}]
jsonApi:handler:find {"type":"photos","id":"72695cbd-e9ef-44f6-85e0-0dbc06a269e8"} +0ms [null,{"id":"72695cbd-e9ef-44f6-85e0-0dbc06a269e8","type":"photos","title":"Penguins","url":"http://www.example.com/penguins","height":220,"width":60,"photographer":{"type":"people","id":"d850ea75-4427-4f81-8595-039990aeede5"}}]
jsonApi:handler:find {"type":"people","id":"32fb0105-acaa-4adb-9ec4-8b49633695e1"} +0ms [null,{"id":"32fb0105-acaa-4adb-9ec4-8b49633695e1","type":"people","firstname":"Pedro","lastname":"Romano","email":"[email protected]"}]
jsonApi:handler:find {"type":"photos","id":"aab14844-97e7-401c-98c8-0bd5ec922d93"} +0ms [null,{"id":"aab14844-97e7-401c-98c8-0bd5ec922d93","type":"photos","title":"Matrix Code","url":"http://www.example.com/foobar","height":1080,"width":1920,"photographer":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}}]
jsonApi:handler:find {"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"} +0ms [null,{"id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587","type":"people","firstname":"Rahul","lastname":"Patel","email":"[email protected]"}]
jsonApi:handler:find {"type":"photos","id":"4a8acd65-78bb-4020-b9eb-2d058a86a2a0"} +0ms [null,{"id":"4a8acd65-78bb-4020-b9eb-2d058a86a2a0","type":"photos","title":"Cup of Tea","url":"http://www.example.com/treat","height":350,"width":350,"photographer":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}}]
jsonApi:validation:output {"id":"cc5cca2e-0dd8-4b95-8cfc-a11230e73116","type":"people","firstname":"Oli","lastname":"Rumbelow","email":"[email protected]"} +8ms
jsonApi:validation:output {"id":"d850ea75-4427-4f81-8595-039990aeede5","type":"people","firstname":"Mark","lastname":"Fermor","email":"[email protected]"} +1ms
jsonApi:validation:output {"id":"aab14844-97e7-401c-98c8-0bd5ec922d93","type":"photos","title":"Matrix Code","url":"http://www.example.com/foobar","height":1080,"width":1920,"photographer":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}} +1ms
jsonApi:validation:output {"id":"72695cbd-e9ef-44f6-85e0-0dbc06a269e8","type":"photos","title":"Penguins","url":"http://www.example.com/penguins","height":220,"width":60,"photographer":{"type":"people","id":"d850ea75-4427-4f81-8595-039990aeede5"}} +1ms
jsonApi:validation:output {"id":"32fb0105-acaa-4adb-9ec4-8b49633695e1","type":"people","firstname":"Pedro","lastname":"Romano","email":"[email protected]"} +1ms
jsonApi:validation:output {"id":"aab14844-97e7-401c-98c8-0bd5ec922d93","type":"photos","title":"Matrix Code","url":"http://www.example.com/foobar","height":1080,"width":1920,"photographer":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}} +0ms
jsonApi:validation:output {"id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587","type":"people","firstname":"Rahul","lastname":"Patel","email":"[email protected]"} +1ms
jsonApi:validation:output {"id":"4a8acd65-78bb-4020-b9eb-2d058a86a2a0","type":"photos","title":"Cup of Tea","url":"http://www.example.com/treat","height":350,"width":350,"photographer":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}} +0ms
jsonApi:include http://localhost:16006/rest/photos/?relationships[photographer]=cc5cca2e-0dd8-4b95-8cfc-a11230e73116& +13ms
jsonApi:include http://localhost:16006/rest/photos/?relationships[photographer]=d850ea75-4427-4f81-8595-039990aeede5& +0ms
jsonApi:include http://localhost:16006/rest/photos/?relationships[photographer]=32fb0105-acaa-4adb-9ec4-8b49633695e1& +1ms
jsonApi:include http://localhost:16006/rest/photos/?relationships[photographer]=ad3aa89e-9c5b-4ac9-a652-6670f9f27587& +0ms
jsonApi:validation:input {"type":"photos","relationships":{"photographer":"cc5cca2e-0dd8-4b95-8cfc-a11230e73116"}} +3ms
jsonApi:validation:input {"type":"photos","relationships":{"photographer":"d850ea75-4427-4f81-8595-039990aeede5"}} +0ms
jsonApi:validation:input {"type":"photos","relationships":{"photographer":"32fb0105-acaa-4adb-9ec4-8b49633695e1"}} +1ms
jsonApi:validation:input {"type":"photos","relationships":{"photographer":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}} +0ms
jsonApi:handler:search {"type":"photos","relationships":{"photographer":"cc5cca2e-0dd8-4b95-8cfc-a11230e73116"}} +0ms [null,[]]
jsonApi:handler:search {"type":"photos","relationships":{"photographer":"d850ea75-4427-4f81-8595-039990aeede5"}} +0ms [null,[{"id":"72695cbd-e9ef-44f6-85e0-0dbc06a269e8","type":"photos","title":"Penguins","url":"http://www.example.com/penguins","height":220,"width":60,"photographer":{"type":"people","id":"d850ea75-4427-4f81-8595-039990aeede5"}}]]
jsonApi:handler:search {"type":"photos","relationships":{"photographer":"32fb0105-acaa-4adb-9ec4-8b49633695e1"}} +1ms [null,[]]
jsonApi:handler:search {"type":"photos","relationships":{"photographer":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}} +0ms [null,[{"id":"aab14844-97e7-401c-98c8-0bd5ec922d93","type":"photos","title":"Matrix Code","url":"http://www.example.com/foobar","height":1080,"width":1920,"photographer":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}},{"id":"4a8acd65-78bb-4020-b9eb-2d058a86a2a0","type":"photos","title":"Cup of Tea","url":"http://www.example.com/treat","height":350,"width":350,"photographer":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}}]]
jsonApi:validation:output {"id":"72695cbd-e9ef-44f6-85e0-0dbc06a269e8","type":"photos","title":"Penguins","url":"http://www.example.com/penguins","height":220,"width":60,"photographer":{"type":"people","id":"d850ea75-4427-4f81-8595-039990aeede5"}} +4ms
jsonApi:validation:output {"id":"aab14844-97e7-401c-98c8-0bd5ec922d93","type":"photos","title":"Matrix Code","url":"http://www.example.com/foobar","height":1080,"width":1920,"photographer":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}} +1ms
jsonApi:validation:output {"id":"4a8acd65-78bb-4020-b9eb-2d058a86a2a0","type":"photos","title":"Cup of Tea","url":"http://www.example.com/treat","height":350,"width":350,"photographer":{"type":"people","id":"ad3aa89e-9c5b-4ac9-a652-6670f9f27587"}} +0ms
โ include author.photos and photos (75ms)