Description
Tomás Cohen Arazi (tcohen)
2025-07-17 03:00:39 UTC
Created attachment 184208 [details] [review] Bug 40424: Add missing tests for search in body Created attachment 184209 [details] [review] Bug 40424: Simplify existing code - preparation I wanted to isolate the changes for the query-in-body handling and it made sense to refactor this dupicated code at the same time. So I add this patch for tidying the area in preparation for the other part. Duplicated code gets simplified. To test: 1. Apply the unit tests patch 2. Run: $ ktd --shell k$ prove t/Koha/REST/Plugin/Query.t \ t/db_dependent/api/v1/*.t \ t/db_dependent/Koha/REST/Plugin/ => SUCCESS: Tests pass! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Created attachment 184210 [details] [review] Bug 40424: Make query-in-body rely on `$c->req->json` This patch removes the reliance on `$c->validation->output` for the query-in-body feature. This will allow bug 40417 to move forward. It also fixes some wrong design decisions we made 5-6 years ago. This was discussed with the Mojolicious::Plugin::OpenAPI maintainer and the agreement was `$c->validation->output` was not stable nor intended to be accessed like we do. To test: 1. Run: $ ktd --shell k$ prove t/Koha/REST/Plugin/Query.t \ t/db_dependent/api/v1/*.t \ t/db_dependent/Koha/REST/Plugin/* => SUCCESS: Tests pass! 2. Apply this patchset 3. Repeat 1 => SUCCESS: Tests pass! 4. Sign off :-D Created attachment 184218 [details] [review] Bug 40424: Add missing tests for search in body Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> Created attachment 184219 [details] [review] Bug 40424: Simplify existing code - preparation I wanted to isolate the changes for the query-in-body handling and it made sense to refactor this dupicated code at the same time. So I add this patch for tidying the area in preparation for the other part. Duplicated code gets simplified. To test: 1. Apply the unit tests patch 2. Run: $ ktd --shell k$ prove t/Koha/REST/Plugin/Query.t \ t/db_dependent/api/v1/*.t \ t/db_dependent/Koha/REST/Plugin/ => SUCCESS: Tests pass! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> Created attachment 184220 [details] [review] Bug 40424: Make query-in-body rely on `$c->req->json` This patch removes the reliance on `$c->validation->output` for the query-in-body feature. This will allow bug 40417 to move forward. It also fixes some wrong design decisions we made 5-6 years ago. This was discussed with the Mojolicious::Plugin::OpenAPI maintainer and the agreement was `$c->validation->output` was not stable nor intended to be accessed like we do. To test: 1. Run: $ ktd --shell k$ prove t/Koha/REST/Plugin/Query.t \ t/db_dependent/api/v1/*.t \ t/db_dependent/Koha/REST/Plugin/* => SUCCESS: Tests pass! 2. Apply this patchset 3. Repeat 1 => SUCCESS: Tests pass! 4. Sign off :-D Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> Created attachment 184554 [details] [review] Bug 40424: Add missing tests for search in body Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Created attachment 184555 [details] [review] Bug 40424: Simplify existing code - preparation I wanted to isolate the changes for the query-in-body handling and it made sense to refactor this dupicated code at the same time. So I add this patch for tidying the area in preparation for the other part. Duplicated code gets simplified. To test: 1. Apply the unit tests patch 2. Run: $ ktd --shell k$ prove t/Koha/REST/Plugin/Query.t \ t/db_dependent/api/v1/*.t \ t/db_dependent/Koha/REST/Plugin/ => SUCCESS: Tests pass! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Created attachment 184556 [details] [review] Bug 40424: Make query-in-body rely on `$c->req->json` This patch removes the reliance on `$c->validation->output` for the query-in-body feature. This will allow bug 40417 to move forward. It also fixes some wrong design decisions we made 5-6 years ago. This was discussed with the Mojolicious::Plugin::OpenAPI maintainer and the agreement was `$c->validation->output` was not stable nor intended to be accessed like we do. To test: 1. Run: $ ktd --shell k$ prove t/Koha/REST/Plugin/Query.t \ t/db_dependent/api/v1/*.t \ t/db_dependent/Koha/REST/Plugin/* => SUCCESS: Tests pass! 2. Apply this patchset 3. Repeat 1 => SUCCESS: Tests pass! 4. Sign off :-D Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Nice consistent approach here. Nice work everyone! Pushed to main for 25.11 |