[Bug 42592] New: Flag +count embeds that cannot be sorted
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42592 Bug ID: 42592 Summary: Flag +count embeds that cannot be sorted Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com Depends on: 41950 After bug 41950, +count embeds backed by a DBIC relationship are automatically sortable. However, some +count embeds are only computed at the Perl level (no matching DBIC relationship) and cannot be sorted. Currently, consumers discover this only by receiving a 400 error when attempting to sort. We need a mechanism to flag or advertise which +count embeds are sortable and which are not. This could be: 1. An annotation in the OpenAPI spec (e.g. x-sortable: false on the embed enum value) 2. A response header listing sortable fields 3. Documentation in the API markdown 4. A dedicated endpoint or metadata response The goal is to let API consumers know upfront which +count columns support sorting, without trial and error. Discussion started in bug 41950 comment 17. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41950 [Bug 41950] Make +count embeds sortable by using SQL-level COUNT subqueries -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42592 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com, | |martin.renvoize@openfifth.c | |o.uk, | |nick@bywatersolutions.com Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Heads up: I'm working on adding `x-koha-unsortable-embeds:` to each path spec. I'm now working on the `koha-api-docs` project to display it nicely. Patches coming in a bit! -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42592 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42592 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42592 --- Comment #2 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 199113 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199113&action=edit Bug 42592: Annotate unsortable +count embeds with x-koha-unsortable-embeds Adds x-koha-unsortable-embeds vendor extension to list operations that advertise +count embeds which cannot be sorted. This lets API consumers know upfront which +count columns do not support sorting, without trial and error. Annotated operations: - GET /acquisitions/orders: biblio.uncancelled_orders+count, current_item_level_holds+count - GET /biblios/{biblio_id}/items: bundle_items_lost+count, bundle_items_not_lost+count - GET /patrons: overdues+count The extension is rendered in the published API docs by adding it to the showExtensions list in koha-api-docs config.yaml. Note: as dependent bugs (42587-42591) are resolved, their embeds should be removed from this list. Test plan: 1. Apply patch 2. Verify the spec is valid: $ ktd --shell k$ cd /kohadevbox/koha k$ prove t/db_dependent/api/v1/swagger/openapi.t => SUCCESS: Spec validates 3. Sign off :-D Assisted-by: Sonnet 4.6 (Anthropic) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42592 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #3 from David Nind <david@davidnind.com> --- Attempted to test (even though I don't understand any of the technical details). However, t/db_dependent/api/v1/swagger/openapi.t doesn't exist. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42592 --- Comment #4 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Thanks, David! I attempted to come up with something clever for testing this and dropped the idea after fighting it a bit. I just forgot to amend the original test plan. The only thing that needs to be tested is bundling the API spec and checking /api/v1/.html shows the metadata. Then it will be used by the API docs to render a nice message about this situation. This is already implemented but we will be able to analyze if we like how it is displayed once we push this. To showcase the changes I made, you can look at how the required permissions are displayed now: https://api.koha-community.org/#tag/cash_registers/operation/listCashRegiste... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42592 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42587 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42587 [Bug 42587] overdues+count is not sortable on the API -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42592 Bug 42592 depends on bug 41950, which changed state. Bug 41950 Summary: Make +count embeds sortable by using SQL-level COUNT subqueries https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41950 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org