Bug 35658 - Typo in /patrons/:patron_id/holds
Summary: Typo in /patrons/:patron_id/holds
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Tomás Cohen Arazi
QA Contact:
URL:
Keywords:
Depends on: 34333
Blocks:
  Show dependency treegraph
 
Reported: 2023-12-28 13:11 UTC by Tomás Cohen Arazi
Modified: 2024-01-12 22:11 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.02,23.05.08


Attachments
Bug 35658: Fix misaligned collectionFormat in patron_holds.yaml (878 bytes, patch)
2023-12-28 13:21 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2023-12-28 13:11:29 UTC
Bug 34333 added the ability to embed cancellation requests information on the holds endpoint, but the `collectionFormat` attribute got misaligned, making the feature unusable.

This is hard to catch. Steps to reproduce:
1. Open your favourite REST tool
2. Make this request:

GET http://kohadev-intra.myDNSname.org:8081/api/v1/patrons/42/holds
x-koha-embed: cancellation_requested

=> SUCCESS: Probably empty result, but not an error

3. Make this change:

 $ git diff
diff --git a/api/v1/swagger/paths/patrons_holds.yaml b/api/v1/swagger/paths/patrons_holds.yaml
index e8e1335a87d..c70d3359c41 100644
--- a/api/v1/swagger/paths/patrons_holds.yaml
+++ b/api/v1/swagger/paths/patrons_holds.yaml
@@ -24,6 +24,7 @@
           type: string
           enum:
             - cancellation_requested
+            - pickup_library
           collectionFormat: csv
     produces:
       - application/json

4. Restart plack:
   $ ktd --shell
  k$ koha-plack --restart kohadev
5. Repeat 2
=> SUCCESS: Same thing
6. Amend the request like this:

GET http://kohadev-intra.myDNSname.org:8081/api/v1/patrons/42/holds
x-koha-embed: cancellation_requested,pickup_library

=> FAIL: You get this, which is weird because it matches exactly what's in the x-koha-embed `enum`:

{
    "errors": [
        {
            "message": "Not in enum list: cancellation_requested, pickup_library.",
            "path": "/x-koha-embed/0"
        }
    ],
    "status": 400
}


This is related to bug 35614.
Comment 1 Tomás Cohen Arazi 2023-12-28 13:21:00 UTC
Created attachment 160353 [details] [review]
Bug 35658: Fix misaligned collectionFormat in patron_holds.yaml

This patch fixes a silly typo.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Jonathan Druart 2024-01-03 15:51:43 UTC
Upping severity, I lost hours on this...
Comment 3 Katrin Fischer 2024-01-03 22:27:22 UTC
I am sorry, holidays got in the way - it's next on my 'push list' already.
Comment 4 Katrin Fischer 2024-01-04 15:53:46 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 5 Fridolin Somers 2024-01-08 14:06:08 UTC
Pushed to 23.11.x for 23.11.02
Comment 6 Lucas Gass 2024-01-12 22:11:50 UTC
Backported to 23.05.x for upcoming 23.05.08