]> git.koha-community.org Git - koha.git/commit
Bug 37018: Add 400 response definition to all routes
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 8 Jul 2024 20:21:25 +0000 (17:21 -0300)
committerFrédéric Demians <f.demians@tamil.fr>
Tue, 23 Jul 2024 13:35:16 +0000 (15:35 +0200)
commit011a85d37cf139433301b23cb81a167f67d86ff9
tree409c71ec7f9b6df5a907f298949e905d353aeebb
parentf245cf3f83791129eb4e5d6b8b2c080bf8edf3ab
Bug 37018: Add 400 response definition to all routes

This patch adds a test for well defined 400 responses on all verbs and
paths on the API spec.

The tests verify:

* Presence of 400 response definition
* The description must start with 'Bad request' (needs coding guideline)
* If DBIC queries are allowed on the route, then `invalid_query` needs
  to be mentioned in the description.

All routes get fixed to make the tests pass.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ yarn api:bundle
  k$ prove xt/api.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
48 files changed:
Koha/REST/Plugin/Exceptions.pm
api/v1/swagger/paths/acquisitions_baskets.yaml
api/v1/swagger/paths/acquisitions_funds.yaml
api/v1/swagger/paths/acquisitions_orders.yaml
api/v1/swagger/paths/acquisitions_vendors.yaml
api/v1/swagger/paths/advancededitormacros.yaml
api/v1/swagger/paths/auth.yaml
api/v1/swagger/paths/authorised_value_categories.yaml
api/v1/swagger/paths/authorised_values.yaml
api/v1/swagger/paths/biblios.yaml
api/v1/swagger/paths/biblios_item_groups.yaml
api/v1/swagger/paths/cash_registers.yaml
api/v1/swagger/paths/checkouts.yaml
api/v1/swagger/paths/circulation-rules.yaml
api/v1/swagger/paths/cities.yaml
api/v1/swagger/paths/clubs.yaml
api/v1/swagger/paths/config_smtp_servers.yaml
api/v1/swagger/paths/erm_agreements.yaml
api/v1/swagger/paths/erm_config.yaml
api/v1/swagger/paths/erm_documents.yaml
api/v1/swagger/paths/erm_eholdings_packages.yaml
api/v1/swagger/paths/erm_eholdings_packages_resources.yaml
api/v1/swagger/paths/erm_eholdings_resources.yaml
api/v1/swagger/paths/erm_eholdings_titles.yaml
api/v1/swagger/paths/erm_eholdings_titles_resources.yaml
api/v1/swagger/paths/erm_licenses.yaml
api/v1/swagger/paths/erm_users.yaml
api/v1/swagger/paths/holds.yaml
api/v1/swagger/paths/ill_backends.yaml
api/v1/swagger/paths/ill_requests.yaml
api/v1/swagger/paths/import_batch_profiles.yaml
api/v1/swagger/paths/import_batches.yaml
api/v1/swagger/paths/items.yaml
api/v1/swagger/paths/jobs.yaml
api/v1/swagger/paths/libraries.yaml
api/v1/swagger/paths/oauth.yaml
api/v1/swagger/paths/patrons.yaml
api/v1/swagger/paths/patrons_account.yaml
api/v1/swagger/paths/patrons_extended_attributes.yaml
api/v1/swagger/paths/patrons_holds.yaml
api/v1/swagger/paths/public_oauth.yaml
api/v1/swagger/paths/quotes.yaml
api/v1/swagger/paths/rotas.yaml
api/v1/swagger/paths/search_filters.yaml
api/v1/swagger/paths/suggestions.yaml
api/v1/swagger/paths/transfer_limits.yaml
t/db_dependent/api/v1/query.t
xt/api.t