[Koha-bugs] [Bug 35658] New: Embedding broken in /patrons/:patron_id/holds

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Dec 28 14:11:29 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35658

            Bug ID: 35658
           Summary: Embedding broken in /patrons/:patron_id/holds
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: REST API
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: tomascohen at gmail.com
                CC: tomascohen at gmail.com

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list