In the context of bug 20212, I noticed that requesting to embed basket and basket.basket_group yields no basket is prefetch.
I also noticed the relation+count case is not being handled correctly (i.e. it won't be prefetch).
Created attachment 100393 [details] [review] Bug 24830: Fix parse_prefetch recursion and +count cases When a child of a prefetched element wasn't found on element's prefetch_whitelist, no prefetch element was returned.. including element it self. Now we return element's name if no child was found. Also, embeded keys that ended with +count where taken literaly. Now we search the correct key by stripping _count of embedded element if it was declared as "is_count"
Should this be needs signoff?
(In reply to Martin Renvoize from comment #3) > Should this be needs signoff? Hi Martin, not yet.. I still have to design how to test.
Created attachment 100664 [details] [review] Bug 24830: Add tests
Created attachment 100665 [details] [review] Bug 24830: Fix parse_prefetch recursion and +count cases When a child of a prefetched element wasn't found on element's prefetch_whitelist, no prefetch element was returned.. including element it self. Now we return element's name if no child was found. Also, embeded keys that ended with +count where taken literaly. Now we search the correct key by stripping _count of embedded element if it was declared as "is_count"
Created attachment 100666 [details] [review] Bug 24830: Fix parse_prefetch recursion and +count cases When a child of a prefetched element wasn't found on element's prefetch_whitelist, no prefetch element was returned.. including element it self. Now we return element's name if no child was found. Also, embeded keys that ended with +count where taken literaly. Now we search the correct key by stripping _count of embedded element if it was declared as "is_count" To test: 1. Apply test patch but not this one 2. prove t/Koha/REST/Plugin/Query.t CHECK => tests shoul fail 3. Apply this patch 4. prove t/Koha/REST/Plugin/Query.t SUCCESS => tests pass 5. Sign off
Created attachment 100689 [details] [review] Bug 24830: Add tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 100690 [details] [review] Bug 24830: Fix parse_prefetch recursion and +count cases When a child of a prefetched element wasn't found on element's prefetch_whitelist, no prefetch element was returned.. including element it self. Now we return element's name if no child was found. Also, embeded keys that ended with +count where taken literaly. Now we search the correct key by stripping _count of embedded element if it was declared as "is_count" To test: 1. Apply test patch but not this one 2. prove t/Koha/REST/Plugin/Query.t CHECK => tests shoul fail 3. Apply this patch 4. prove t/Koha/REST/Plugin/Query.t SUCCESS => tests pass 5. Sign off Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 101089 [details] [review] Bug 24830: Add tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 101090 [details] [review] Bug 24830: Fix parse_prefetch recursion and +count cases When a child of a prefetched element wasn't found on element's prefetch_whitelist, no prefetch element was returned.. including element it self. Now we return element's name if no child was found. Also, embeded keys that ended with +count where taken literaly. Now we search the correct key by stripping _count of embedded element if it was declared as "is_count" To test: 1. Apply test patch but not this one 2. prove t/Koha/REST/Plugin/Query.t CHECK => tests shoul fail 3. Apply this patch 4. prove t/Koha/REST/Plugin/Query.t SUCCESS => tests pass 5. Sign off Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Nice work everyone! Pushed to master for 20.05
not backported to 19.11.x due to dependencies