]> 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)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Thu, 1 Aug 2024 15:26:44 +0000 (17:26 +0200)
commit35e9ac9b0a9f9b6786b4988f9013ef4dc9c43a7f
tree452249fdcd4fa888957cf6cd09f946a02abd1890
parente77db213a55f229b5c5e9179ef15deb8de9ebc13
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: Katrin Fischer <katrin.fischer@bsz-bw.de>
77 files changed:
Koha/REST/Plugin/Exceptions.pm
api/v1/swagger/paths/acquisitions_baskets.yaml
api/v1/swagger/paths/acquisitions_edifiles.yaml
api/v1/swagger/paths/acquisitions_funds.yaml
api/v1/swagger/paths/acquisitions_orders.yaml
api/v1/swagger/paths/acquisitions_vendor_issues.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/authorities.yaml
api/v1/swagger/paths/biblios.yaml
api/v1/swagger/paths/biblios_item_groups.yaml
api/v1/swagger/paths/biblios_merge.yaml
api/v1/swagger/paths/bookings.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/deleted_biblios.yaml
api/v1/swagger/paths/erm_agreements.yaml
api/v1/swagger/paths/erm_counter_files.yaml
api/v1/swagger/paths/erm_counter_logs.yaml
api/v1/swagger/paths/erm_counter_registries.yaml
api/v1/swagger/paths/erm_custom_reports.yaml
api/v1/swagger/paths/erm_default_usage_reports.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_sushi_services.yaml
api/v1/swagger/paths/erm_usage_data_providers.yaml
api/v1/swagger/paths/erm_usage_databases.yaml
api/v1/swagger/paths/erm_usage_items.yaml
api/v1/swagger/paths/erm_usage_platforms.yaml
api/v1/swagger/paths/erm_usage_titles.yaml
api/v1/swagger/paths/erm_users.yaml
api/v1/swagger/paths/extended_attribute_types.yaml
api/v1/swagger/paths/holds.yaml
api/v1/swagger/paths/ill_backends.yaml
api/v1/swagger/paths/ill_batches.yaml
api/v1/swagger/paths/ill_batchstatuses.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/item_types.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/patron_categories.yaml
api/v1/swagger/paths/patrons.yaml
api/v1/swagger/paths/patrons_account.yaml
api/v1/swagger/paths/patrons_checkouts.yaml
api/v1/swagger/paths/patrons_extended_attributes.yaml
api/v1/swagger/paths/patrons_holds.yaml
api/v1/swagger/paths/patrons_recalls.yaml
api/v1/swagger/paths/preservation_processings.yaml
api/v1/swagger/paths/preservation_trains.yaml
api/v1/swagger/paths/preservation_waiting_list.yaml
api/v1/swagger/paths/public_oauth.yaml
api/v1/swagger/paths/public_patrons.yaml
api/v1/swagger/paths/quotes.yaml
api/v1/swagger/paths/record_sources.yaml
api/v1/swagger/paths/rotas.yaml
api/v1/swagger/paths/search_filters.yaml
api/v1/swagger/paths/suggestions.yaml
api/v1/swagger/paths/tickets.yaml
api/v1/swagger/paths/transfer_limits.yaml
t/db_dependent/api/v1/query.t
xt/api.t