Summary: | Add a way to specify nested objects to embed in OpenAPI | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | REST API | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | CLOSED FIXED | QA Contact: | Martin Renvoize (ashimema) <martin.renvoize> |
Severity: | new feature | ||
Priority: | P5 - low | CC: | 1joynelson, agustinmoyano, ere.maijala, jonathan.druart, josef.moravec, kyle, martin.renvoize, nick, oleonard, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This development introduces a way to define embeddable objects on API routes. On the path specs, they will be specified using dot notation for nested embeddings:
"x-koha-embed": [
'biblio',
'biblio.items',
'fund'
]
The consumer will need to add a header to the request, specifying the things they want to embed using comma-separated values like this:
x-koha-embed: 'biblio,fund'
This header will be validated against the endpoint spec and an error code will be returned if the request is not appropriate.
|
Version(s) released in: |
20.05.00
|
Circulation function: | |||
Bug Depends on: | 24228 | ||
Bug Blocks: | 18731 | ||
Attachments: |
Bug 24302: Add a way to specify nested objects to embed in OpenAPI
Bug 24302: Add a way to specify nested objects to embed in OpenAPI Bug 24302: Add a way to specify nested objects to embed in OpenAPI Bug 24302: Add a way to specify nested objects to embed in OpenAPI Bug 24302: Add a way to specify nested objects to embed in OpenAPI Bug 24302: Add a way to specify nested objects to embed in OpenAPI Bug 24302: Add a way to specify nested objects to embed in OpenAPI |
Description
Tomás Cohen Arazi (tcohen)
2019-12-23 18:12:59 UTC
Created attachment 96619 [details] [review] 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. Submitting early for community scrutiny. Created attachment 96624 [details] [review] 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 TODO: Add tests for the authenticate_api_request change on the API itself. Created attachment 96639 [details] [review] 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 Created attachment 96640 [details] [review] 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 Comment on attachment 96640 [details] [review] Bug 24302: Add a way to specify nested objects to embed in OpenAPI Rebased Created attachment 96756 [details] [review] 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 Created attachment 96956 [details] [review] 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> Created attachment 96957 [details] [review] 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> Nice work everyone! Pushed to master for 20.05 Does not apply to 19.11.x. Tomas if you need this in 19.11.x I'll need help getting to it to apply. Thanks! New feature not pushed to 19.11.x |