Bug 39817

Summary: All list endpoints should have the x-koha-request-id parameter definition
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: REST APIAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: tomascohen
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 39817: Add some GET routes tests

Description Tomás Cohen Arazi (tcohen) 2025-05-02 13:18:02 UTC
This is mandatory for using them with our `kohaTable` datatables wrapper.

I spotted the `/acquisitions/baskets` endpoint doesn't have it. We should have a test for it.
Comment 1 Tomás Cohen Arazi (tcohen) 2025-05-02 14:16:16 UTC
Created attachment 181869 [details] [review]
Bug 39817: Add some GET routes tests

This patch adds tests for to-be mandatory parameters for plural
endpoints:

* match
* order_by
* page
* per_page
* q_param
* q_body
* request_id_header

Exceptions should be added if found in the wild, but the tests are
needed.

Another check it adds is GET requests `operationId` should start with:

* list
* get

To test:
1. Run:
   $ ktd --shell
  k$ prove xt/api.t
=> FAIL: Tests pass! But our spec is bad
2. Apply this patch
3. Repeat 1
=> SUCCESS: All mistakes make the tests fail!
4. Sign off :-D

Note: a follow-up patch/set of patches should make this tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>