Bug 24302: Add a way to specify nested objects to embed in OpenAPI
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 23 Dec 2019 13:26:04 +0000 (10:26 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 8 Jan 2020 15:12:26 +0000 (15:12 +0000)
commit4dff91004e8275f8d392340e95b3d05006d5770e
tree30fcbc54341d83562b9c7ef6080678b5af760d48
parent954c742cc63d569cdba06325904a88097c4cc2ba
Bug 24302: Add a way to specify nested objects to embed in OpenAPI

This patch introduces a helper for handling x-koha-embed headers on API
requests. It reads the embed definitions and adds them to the stash for
later use (either manually on the controllers, or in the objects.search
helper.

x-koha-embed needs to be defined as a list on the OpenAPI spec.

It throws an exception when invalid combinations are found.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass!
3.Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/Plugin/Query.pm
t/Koha/REST/Plugin/Query.t