From e97d48c45414a5a88025c999ecf4432fef901643 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 8 Jul 2024 17:21:25 -0300 Subject: [PATCH] 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 Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- Koha/REST/Plugin/Exceptions.pm | 2 +- .../swagger/paths/acquisitions_baskets.yaml | 7 ++ api/v1/swagger/paths/acquisitions_funds.yaml | 21 +++++ api/v1/swagger/paths/acquisitions_orders.yaml | 19 +++++ .../paths/acquisitions_vendor_issues.yaml | 7 ++ .../swagger/paths/acquisitions_vendors.yaml | 23 ++++++ .../swagger/paths/advancededitormacros.yaml | 39 +++++++++ api/v1/swagger/paths/auth.yaml | 82 +++++++++++++++---- .../paths/authorised_value_categories.yaml | 5 +- api/v1/swagger/paths/authorised_values.yaml | 5 +- api/v1/swagger/paths/authorities.yaml | 17 +++- api/v1/swagger/paths/biblios.yaml | 56 ++++++++++++- api/v1/swagger/paths/biblios_item_groups.yaml | 19 ++++- api/v1/swagger/paths/biblios_merge.yaml | 4 + api/v1/swagger/paths/bookings.yaml | 19 ++++- api/v1/swagger/paths/cash_registers.yaml | 11 +++ api/v1/swagger/paths/checkouts.yaml | 37 ++++++++- api/v1/swagger/paths/circulation-rules.yaml | 4 + api/v1/swagger/paths/cities.yaml | 23 ++++++ api/v1/swagger/paths/clubs.yaml | 2 +- api/v1/swagger/paths/config_smtp_servers.yaml | 23 ++++++ api/v1/swagger/paths/erm_agreements.yaml | 17 ++-- api/v1/swagger/paths/erm_counter_files.yaml | 13 ++- api/v1/swagger/paths/erm_counter_logs.yaml | 7 +- .../swagger/paths/erm_counter_registries.yaml | 7 +- api/v1/swagger/paths/erm_custom_reports.yaml | 30 ++++++- .../paths/erm_default_usage_reports.yaml | 15 ++-- api/v1/swagger/paths/erm_documents.yaml | 4 + .../swagger/paths/erm_eholdings_packages.yaml | 21 +++-- .../erm_eholdings_packages_resources.yaml | 7 +- .../paths/erm_eholdings_resources.yaml | 15 +++- .../swagger/paths/erm_eholdings_titles.yaml | 19 +++-- .../paths/erm_eholdings_titles_resources.yaml | 7 +- api/v1/swagger/paths/erm_licenses.yaml | 17 ++-- api/v1/swagger/paths/erm_sushi_services.yaml | 7 +- .../paths/erm_usage_data_providers.yaml | 23 ++++-- api/v1/swagger/paths/erm_usage_databases.yaml | 9 +- api/v1/swagger/paths/erm_usage_items.yaml | 9 +- api/v1/swagger/paths/erm_usage_platforms.yaml | 9 +- api/v1/swagger/paths/erm_usage_titles.yaml | 7 +- api/v1/swagger/paths/erm_users.yaml | 7 +- api/v1/swagger/paths/holds.yaml | 32 ++++++-- api/v1/swagger/paths/ill_backends.yaml | 10 ++- api/v1/swagger/paths/ill_batches.yaml | 18 ++++ api/v1/swagger/paths/ill_batchstatuses.yaml | 12 +++ api/v1/swagger/paths/ill_requests.yaml | 7 ++ .../swagger/paths/import_batch_profiles.yaml | 15 +++- api/v1/swagger/paths/import_batches.yaml | 6 +- api/v1/swagger/paths/item_types.yaml | 7 +- api/v1/swagger/paths/items.yaml | 41 ++++++++-- api/v1/swagger/paths/jobs.yaml | 11 +++ api/v1/swagger/paths/libraries.yaml | 40 +++++++++ api/v1/swagger/paths/oauth.yaml | 4 +- api/v1/swagger/paths/patron_categories.yaml | 7 ++ api/v1/swagger/paths/patrons.yaml | 29 ++++++- api/v1/swagger/paths/patrons_account.yaml | 24 +++++- api/v1/swagger/paths/patrons_checkouts.yaml | 7 ++ .../paths/patrons_extended_attributes.yaml | 17 +++- api/v1/swagger/paths/patrons_holds.yaml | 7 ++ api/v1/swagger/paths/patrons_recalls.yaml | 7 ++ .../paths/preservation_processings.yaml | 23 ++++-- api/v1/swagger/paths/preservation_trains.yaml | 45 ++++++---- .../paths/preservation_waiting_list.yaml | 11 ++- api/v1/swagger/paths/public_oauth.yaml | 7 +- api/v1/swagger/paths/public_patrons.yaml | 2 +- api/v1/swagger/paths/quotes.yaml | 23 ++++++ api/v1/swagger/paths/search_filters.yaml | 23 ++++++ api/v1/swagger/paths/suggestions.yaml | 22 +++++ api/v1/swagger/paths/tickets.yaml | 41 ++++++++++ api/v1/swagger/paths/transfer_limits.yaml | 13 ++- t/db_dependent/api/v1/query.t | 2 +- xt/api.t | 45 +++++++++- 72 files changed, 1079 insertions(+), 154 deletions(-) diff --git a/Koha/REST/Plugin/Exceptions.pm b/Koha/REST/Plugin/Exceptions.pm index 22f0b31443..5107af103d 100644 --- a/Koha/REST/Plugin/Exceptions.pm +++ b/Koha/REST/Plugin/Exceptions.pm @@ -61,7 +61,7 @@ sub register { if ( blessed $exception && ref($exception) eq 'Koha::Exceptions::REST::Query::InvalidOperator' ) { return $c->render( - status => 500, + status => 400, json => { error => printf( "Invalid operator in query: %s", $exception->operator ), error_code => 'invalid_query', diff --git a/api/v1/swagger/paths/acquisitions_baskets.yaml b/api/v1/swagger/paths/acquisitions_baskets.yaml index 0adf26de00..38e70a836e 100644 --- a/api/v1/swagger/paths/acquisitions_baskets.yaml +++ b/api/v1/swagger/paths/acquisitions_baskets.yaml @@ -33,6 +33,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/patron" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: diff --git a/api/v1/swagger/paths/acquisitions_funds.yaml b/api/v1/swagger/paths/acquisitions_funds.yaml index 174b52d4d4..c262e98e2e 100644 --- a/api/v1/swagger/paths/acquisitions_funds.yaml +++ b/api/v1/swagger/paths/acquisitions_funds.yaml @@ -33,6 +33,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/fund" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -93,6 +100,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/patron" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -145,6 +159,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/patron" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: diff --git a/api/v1/swagger/paths/acquisitions_orders.yaml b/api/v1/swagger/paths/acquisitions_orders.yaml index 1cd70a4d2c..e5bd615f81 100644 --- a/api/v1/swagger/paths/acquisitions_orders.yaml +++ b/api/v1/swagger/paths/acquisitions_orders.yaml @@ -74,6 +74,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/order" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -191,6 +198,10 @@ description: An order schema: $ref: "../swagger.yaml#/definitions/order" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -238,6 +249,10 @@ description: An order schema: $ref: "../swagger.yaml#/definitions/order" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -277,6 +292,10 @@ responses: "204": description: Order deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/acquisitions_vendor_issues.yaml b/api/v1/swagger/paths/acquisitions_vendor_issues.yaml index d55cb2a884..be2dc58ee7 100644 --- a/api/v1/swagger/paths/acquisitions_vendor_issues.yaml +++ b/api/v1/swagger/paths/acquisitions_vendor_issues.yaml @@ -64,6 +64,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/vendor_issue" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/acquisitions_vendors.yaml b/api/v1/swagger/paths/acquisitions_vendors.yaml index 7af2fbc48a..ed817cc2a1 100644 --- a/api/v1/swagger/paths/acquisitions_vendors.yaml +++ b/api/v1/swagger/paths/acquisitions_vendors.yaml @@ -43,6 +43,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/vendor" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -89,6 +96,10 @@ description: Vendor added schema: $ref: "../swagger.yaml#/definitions/vendor" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -131,6 +142,10 @@ description: A vendor schema: $ref: "../swagger.yaml#/definitions/vendor" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -178,6 +193,10 @@ description: A vendor schema: $ref: "../swagger.yaml#/definitions/vendor" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -217,6 +236,10 @@ responses: "204": description: Vendor deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/advancededitormacros.yaml b/api/v1/swagger/paths/advancededitormacros.yaml index b6ad3c731a..e288d2fc17 100644 --- a/api/v1/swagger/paths/advancededitormacros.yaml +++ b/api/v1/swagger/paths/advancededitormacros.yaml @@ -43,6 +43,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/advancededitormacro" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -81,6 +88,10 @@ description: Macro added schema: $ref: "../swagger.yaml#/definitions/advancededitormacro" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -121,6 +132,10 @@ description: Macro added schema: $ref: "../swagger.yaml#/definitions/advancededitormacro" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -158,6 +173,10 @@ description: A macro schema: $ref: "../swagger.yaml#/definitions/advancededitormacro" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -198,6 +217,10 @@ description: An advanced editor macro schema: $ref: "../swagger.yaml#/definitions/advancededitormacro" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -236,6 +259,10 @@ description: Advanced editor macro deleted schema: type: string + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -275,6 +302,10 @@ description: A macro schema: $ref: "../swagger.yaml#/definitions/advancededitormacro" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -315,6 +346,10 @@ description: An advanced editor macro schema: $ref: "../swagger.yaml#/definitions/advancededitormacro" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -355,6 +390,10 @@ description: Advanced editor macro deleted schema: type: string + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/auth.yaml b/api/v1/swagger/paths/auth.yaml index b9dee70cdc..052565e4de 100644 --- a/api/v1/swagger/paths/auth.yaml +++ b/api/v1/swagger/paths/auth.yaml @@ -22,7 +22,7 @@ type: integer additionalProperties: false "400": - description: Bad Request + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "403": @@ -65,7 +65,7 @@ type: string additionalProperties: false "400": - description: Bad Request + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "403": @@ -111,7 +111,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "400": - description: Bad Request + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "403": @@ -163,9 +163,12 @@ items: $ref: ../swagger.yaml#/definitions/auth_provider "400": - description: Bad Request + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: - $ref: ../swagger.yaml#/definitions/error + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -225,7 +228,7 @@ schema: $ref: ../swagger.yaml#/definitions/auth_provider "400": - description: Bad Request + description: Bad request schema: $ref: ../swagger.yaml#/definitions/error "403": @@ -272,6 +275,10 @@ description: An identity provider schema: $ref: ../swagger.yaml#/definitions/auth_provider + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: Object not found schema: @@ -332,7 +339,7 @@ schema: $ref: ../swagger.yaml#/definitions/auth_provider "400": - description: Bad Request + description: Bad request schema: $ref: ../swagger.yaml#/definitions/error "403": @@ -370,6 +377,10 @@ responses: "204": description: identity provider deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -428,6 +439,13 @@ schema: items: $ref: ../swagger.yaml#/definitions/auth_provider_domain + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: Object not found schema: @@ -468,7 +486,7 @@ schema: $ref: ../swagger.yaml#/definitions/auth_provider_domain "400": - description: Bad Request + description: Bad request schema: $ref: ../swagger.yaml#/definitions/error "403": @@ -510,6 +528,10 @@ description: An identity provider schema: $ref: ../swagger.yaml#/definitions/auth_provider_domain + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: Object not found schema: @@ -542,6 +564,10 @@ responses: "204": description: identity provider deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -601,9 +627,12 @@ items: $ref: ../swagger.yaml#/definitions/identity_provider "400": - description: Bad Request + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: - $ref: ../swagger.yaml#/definitions/error + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -663,7 +692,7 @@ schema: $ref: ../swagger.yaml#/definitions/identity_provider "400": - description: Bad Request + description: Bad request schema: $ref: ../swagger.yaml#/definitions/error "403": @@ -710,6 +739,10 @@ description: An identity provider schema: $ref: ../swagger.yaml#/definitions/identity_provider + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: Object not found schema: @@ -770,7 +803,7 @@ schema: $ref: ../swagger.yaml#/definitions/identity_provider "400": - description: Bad Request + description: Bad request schema: $ref: ../swagger.yaml#/definitions/error "403": @@ -807,7 +840,11 @@ - application/json responses: "204": - description: identity provider deleted + description: Identity provider deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -866,6 +903,13 @@ schema: items: $ref: ../swagger.yaml#/definitions/identity_provider_domain + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: Object not found schema: @@ -906,7 +950,7 @@ schema: $ref: ../swagger.yaml#/definitions/identity_provider_domain "400": - description: Bad Request + description: Bad request schema: $ref: ../swagger.yaml#/definitions/error "403": @@ -948,6 +992,10 @@ description: An identity provider schema: $ref: ../swagger.yaml#/definitions/identity_provider_domain + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: Object not found schema: @@ -989,7 +1037,7 @@ schema: $ref: ../swagger.yaml#/definitions/identity_provider_domain "400": - description: Bad Request + description: Bad request schema: $ref: ../swagger.yaml#/definitions/error "403": @@ -1028,6 +1076,10 @@ responses: "204": description: identity provider deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/authorised_value_categories.yaml b/api/v1/swagger/paths/authorised_value_categories.yaml index dc33c37847..dbb7958506 100644 --- a/api/v1/swagger/paths/authorised_value_categories.yaml +++ b/api/v1/swagger/paths/authorised_value_categories.yaml @@ -33,7 +33,10 @@ $ref: "../swagger.yaml#/definitions/authorised_value_category" type: array 400: - description: Bad request + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: diff --git a/api/v1/swagger/paths/authorised_values.yaml b/api/v1/swagger/paths/authorised_values.yaml index 07e298dc21..f1bea9e92d 100644 --- a/api/v1/swagger/paths/authorised_values.yaml +++ b/api/v1/swagger/paths/authorised_values.yaml @@ -58,7 +58,10 @@ $ref: "../swagger.yaml#/definitions/authorised_value" type: array 400: - description: Bad request + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: diff --git a/api/v1/swagger/paths/authorities.yaml b/api/v1/swagger/paths/authorities.yaml index 17fb83ece6..05d1e39330 100644 --- a/api/v1/swagger/paths/authorities.yaml +++ b/api/v1/swagger/paths/authorities.yaml @@ -23,6 +23,13 @@ responses: "200": description: A list of authorities + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -91,7 +98,7 @@ "201": description: An authority "400": - description: Bad request. + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -148,6 +155,10 @@ responses: "200": description: An authority + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -196,6 +207,10 @@ description: Authority deleted schema: type: string + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/biblios.yaml b/api/v1/swagger/paths/biblios.yaml index 3070253557..22504b310a 100644 --- a/api/v1/swagger/paths/biblios.yaml +++ b/api/v1/swagger/paths/biblios.yaml @@ -83,6 +83,13 @@ responses: "200": description: A list of biblios + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -134,6 +141,10 @@ responses: "200": description: A biblio + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -182,6 +193,10 @@ description: Biblio deleted schema: type: string + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -311,6 +326,13 @@ type: array items: $ref: ../swagger.yaml#/definitions/booking + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -382,6 +404,13 @@ description: A list of checkouts schema: $ref: "../swagger.yaml#/definitions/checkouts" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -447,6 +476,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/item" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -624,7 +660,10 @@ items: $ref: "../swagger.yaml#/definitions/library" "400": - description: Missing or wrong parameters + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -670,6 +709,10 @@ responses: "200": description: A biblio + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -736,6 +779,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/item" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -809,6 +859,10 @@ description: number of ratings type: integer additionalProperties: false + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/biblios_item_groups.yaml b/api/v1/swagger/paths/biblios_item_groups.yaml index 7491220fb9..4576411db0 100644 --- a/api/v1/swagger/paths/biblios_item_groups.yaml +++ b/api/v1/swagger/paths/biblios_item_groups.yaml @@ -37,6 +37,13 @@ type: array items: "$ref": "../swagger.yaml#/definitions/item_group" + '400': + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" '401': description: Authentication required schema: @@ -90,7 +97,7 @@ schema: "$ref": "../swagger.yaml#/definitions/item_group" '400': - description: Bad parameter + description: Bad request schema: "$ref": "../swagger.yaml#/definitions/error" '401': @@ -156,7 +163,7 @@ schema: "$ref": "../swagger.yaml#/definitions/item_group" '400': - description: Missing or wrong parameters + description: Bad request schema: "$ref": "../swagger.yaml#/definitions/error" '404': @@ -273,6 +280,10 @@ description: ItemGroup deleted schema: type: string + '400': + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" '401': description: Authentication required schema: @@ -397,6 +408,10 @@ description: Item unlinked from item group schema: type: string + '400': + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" '401': description: Authentication required schema: diff --git a/api/v1/swagger/paths/biblios_merge.yaml b/api/v1/swagger/paths/biblios_merge.yaml index cf83b5236f..d3608ea35b 100644 --- a/api/v1/swagger/paths/biblios_merge.yaml +++ b/api/v1/swagger/paths/biblios_merge.yaml @@ -24,6 +24,10 @@ responses: '200': description: The merge result as a biblio record + '400': + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" '404': description: Biblio not found schema: diff --git a/api/v1/swagger/paths/bookings.yaml b/api/v1/swagger/paths/bookings.yaml index f7bb0b8804..5231d65508 100644 --- a/api/v1/swagger/paths/bookings.yaml +++ b/api/v1/swagger/paths/bookings.yaml @@ -56,6 +56,13 @@ items: $ref: ../swagger.yaml#/definitions/booking type: array + 400: + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" 403: description: Access forbidden schema: @@ -91,7 +98,7 @@ schema: $ref: ../swagger.yaml#/definitions/booking 400: - description: Client error + description: Bad request schema: $ref: ../swagger.yaml#/definitions/error 401: @@ -131,6 +138,10 @@ responses: 204: description: Booking deleted + 400: + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: @@ -169,6 +180,10 @@ description: A booking schema: $ref: ../swagger.yaml#/definitions/booking + 400: + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 404: description: Booking not found schema: @@ -206,7 +221,7 @@ schema: $ref: ../swagger.yaml#/definitions/booking 400: - description: Client error + description: Bad request schema: $ref: ../swagger.yaml#/definitions/error 401: diff --git a/api/v1/swagger/paths/cash_registers.yaml b/api/v1/swagger/paths/cash_registers.yaml index 632fa2274f..4fb4dff012 100644 --- a/api/v1/swagger/paths/cash_registers.yaml +++ b/api/v1/swagger/paths/cash_registers.yaml @@ -34,6 +34,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/cashup" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -82,6 +89,10 @@ description: A cashup schema: $ref: "../swagger.yaml#/definitions/cashup" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: diff --git a/api/v1/swagger/paths/checkouts.yaml b/api/v1/swagger/paths/checkouts.yaml index 5964f61cb7..24199736e1 100644 --- a/api/v1/swagger/paths/checkouts.yaml +++ b/api/v1/swagger/paths/checkouts.yaml @@ -38,6 +38,13 @@ description: A list of checkouts schema: $ref: "../swagger.yaml#/definitions/checkouts" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -90,7 +97,7 @@ schema: $ref: "../swagger.yaml#/definitions/checkout" "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -150,6 +157,10 @@ description: Updated borrower's checkout schema: $ref: "../swagger.yaml#/definitions/checkout" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -189,6 +200,10 @@ description: Updated borrower's checkout schema: $ref: "../swagger.yaml#/definitions/checkout" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Cannot renew checkout schema: @@ -228,6 +243,10 @@ description: Updated borrower's checkout schema: $ref: "../swagger.yaml#/definitions/checkout" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Cannot renew checkout schema: @@ -275,6 +294,10 @@ description: List of checkouts renewals schema: $ref: "../swagger.yaml#/definitions/renewals" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -313,6 +336,10 @@ description: Checkout renewability information schema: $ref: "../swagger.yaml#/definitions/allows_renewal" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Forbidden schema: @@ -352,6 +379,10 @@ description: Availability schema: $ref: "../swagger.yaml#/definitions/checkout_availability" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -397,6 +428,10 @@ confirmation_token: type: string additionalProperties: false + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: diff --git a/api/v1/swagger/paths/circulation-rules.yaml b/api/v1/swagger/paths/circulation-rules.yaml index 545f15458a..b5f9222099 100644 --- a/api/v1/swagger/paths/circulation-rules.yaml +++ b/api/v1/swagger/paths/circulation-rules.yaml @@ -15,6 +15,10 @@ type: object additionalProperties: $ref: "../swagger.yaml#/definitions/circ-rule-kind" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: diff --git a/api/v1/swagger/paths/cities.yaml b/api/v1/swagger/paths/cities.yaml index b7e43a3281..2e36d02807 100644 --- a/api/v1/swagger/paths/cities.yaml +++ b/api/v1/swagger/paths/cities.yaml @@ -43,6 +43,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/city" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -81,6 +88,10 @@ description: City added schema: $ref: "../swagger.yaml#/definitions/city" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -119,6 +130,10 @@ description: A city schema: $ref: "../swagger.yaml#/definitions/city" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: City not found schema: @@ -158,6 +173,10 @@ description: A city schema: $ref: "../swagger.yaml#/definitions/city" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -194,6 +213,10 @@ responses: "204": description: City deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/clubs.yaml b/api/v1/swagger/paths/clubs.yaml index 7e09954d7c..9d04355ee2 100644 --- a/api/v1/swagger/paths/clubs.yaml +++ b/api/v1/swagger/paths/clubs.yaml @@ -61,7 +61,7 @@ schema: $ref: "../definitions/club_hold.yaml" "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": diff --git a/api/v1/swagger/paths/config_smtp_servers.yaml b/api/v1/swagger/paths/config_smtp_servers.yaml index e07458a9a8..dc75b2c7aa 100644 --- a/api/v1/swagger/paths/config_smtp_servers.yaml +++ b/api/v1/swagger/paths/config_smtp_servers.yaml @@ -23,6 +23,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/smtp_server" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -61,6 +68,10 @@ description: An SMTP server object schema: $ref: "../swagger.yaml#/definitions/smtp_server" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -103,6 +114,10 @@ description: An SMTP server object schema: $ref: "../swagger.yaml#/definitions/smtp_server" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: Object not found schema: @@ -146,6 +161,10 @@ description: An SMTP server object schema: $ref: "../swagger.yaml#/definitions/smtp_server" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -185,6 +204,10 @@ responses: "204": description: SMTP server deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/erm_agreements.yaml b/api/v1/swagger/paths/erm_agreements.yaml index 4e543f7a8d..43a48e1179 100644 --- a/api/v1/swagger/paths/erm_agreements.yaml +++ b/api/v1/swagger/paths/erm_agreements.yaml @@ -83,8 +83,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_agreement" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -128,7 +131,7 @@ items: $ref: "../swagger.yaml#/definitions/erm_agreement" 400: - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -202,6 +205,10 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_agreement" + 400: + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: @@ -266,7 +273,7 @@ items: $ref: "../swagger.yaml#/definitions/erm_agreement" 400: - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -312,7 +319,7 @@ 204: description: Agreement deleted 400: - description: Agreement deletion failed + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: diff --git a/api/v1/swagger/paths/erm_counter_files.yaml b/api/v1/swagger/paths/erm_counter_files.yaml index 7e244e948f..60ac800674 100644 --- a/api/v1/swagger/paths/erm_counter_files.yaml +++ b/api/v1/swagger/paths/erm_counter_files.yaml @@ -19,6 +19,10 @@ description: A counter file schema: type: file + 400: + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: @@ -108,7 +112,10 @@ $ref: "../swagger.yaml#/definitions/erm_counter_file" type: array 400: - description: Bad request + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -143,7 +150,7 @@ 204: description: counter_file deleted 400: - description: counter_file deletion failed + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -174,4 +181,4 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - erm: 1 \ No newline at end of file + erm: 1 diff --git a/api/v1/swagger/paths/erm_counter_logs.yaml b/api/v1/swagger/paths/erm_counter_logs.yaml index 01c18ace3f..2d73cc4302 100644 --- a/api/v1/swagger/paths/erm_counter_logs.yaml +++ b/api/v1/swagger/paths/erm_counter_logs.yaml @@ -27,7 +27,10 @@ $ref: "../swagger.yaml#/definitions/erm_counter_log" type: array 400: - description: Bad request + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -46,4 +49,4 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - erm: 1 \ No newline at end of file + erm: 1 diff --git a/api/v1/swagger/paths/erm_counter_registries.yaml b/api/v1/swagger/paths/erm_counter_registries.yaml index a39691bf23..afe2bdc227 100644 --- a/api/v1/swagger/paths/erm_counter_registries.yaml +++ b/api/v1/swagger/paths/erm_counter_registries.yaml @@ -23,7 +23,10 @@ $ref: "../swagger.yaml#/definitions/erm_counter_registry" type: array 400: - description: Bad request + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -42,4 +45,4 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - erm: 1 \ No newline at end of file + erm: 1 diff --git a/api/v1/swagger/paths/erm_custom_reports.yaml b/api/v1/swagger/paths/erm_custom_reports.yaml index d0bd51949e..47e4bd5339 100644 --- a/api/v1/swagger/paths/erm_custom_reports.yaml +++ b/api/v1/swagger/paths/erm_custom_reports.yaml @@ -32,6 +32,13 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_custom_report" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: authentication required schema: @@ -91,6 +98,13 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_custom_report" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: authentication required schema: @@ -150,6 +164,13 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_custom_report" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: authentication required schema: @@ -212,6 +233,13 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_custom_report" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: authentication required schema: @@ -236,4 +264,4 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - erm: 1 \ No newline at end of file + erm: 1 diff --git a/api/v1/swagger/paths/erm_default_usage_reports.yaml b/api/v1/swagger/paths/erm_default_usage_reports.yaml index aa37c409ab..51199e626e 100644 --- a/api/v1/swagger/paths/erm_default_usage_reports.yaml +++ b/api/v1/swagger/paths/erm_default_usage_reports.yaml @@ -37,8 +37,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_default_usage_report" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -82,7 +85,7 @@ items: $ref: "../swagger.yaml#/definitions/erm_default_usage_report" 400: - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -132,8 +135,8 @@ responses: 204: description: default_usage_report deleted - 400: - description: default_usage_report deletion failed + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -164,4 +167,4 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - erm: 1 \ No newline at end of file + erm: 1 diff --git a/api/v1/swagger/paths/erm_documents.yaml b/api/v1/swagger/paths/erm_documents.yaml index 80be3279b3..a0b4426675 100644 --- a/api/v1/swagger/paths/erm_documents.yaml +++ b/api/v1/swagger/paths/erm_documents.yaml @@ -19,6 +19,10 @@ description: Anagreement schema: type: file + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: diff --git a/api/v1/swagger/paths/erm_eholdings_packages.yaml b/api/v1/swagger/paths/erm_eholdings_packages.yaml index 1d2f3db4ce..895c1acf05 100644 --- a/api/v1/swagger/paths/erm_eholdings_packages.yaml +++ b/api/v1/swagger/paths/erm_eholdings_packages.yaml @@ -80,8 +80,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_eholdings_package" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -130,7 +133,7 @@ items: $ref: "../swagger.yaml#/definitions/erm_eholdings_package" 400: - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -197,6 +200,10 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_eholdings_package" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: @@ -263,7 +270,7 @@ items: $ref: "../swagger.yaml#/definitions/erm_eholdings_package" 400: - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -310,7 +317,7 @@ 204: description: package deleted 400: - description: package deletion failed + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -378,6 +385,10 @@ description: Add or remove this package from remote holdings type: boolean additionalProperties: false + 400: + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: diff --git a/api/v1/swagger/paths/erm_eholdings_packages_resources.yaml b/api/v1/swagger/paths/erm_eholdings_packages_resources.yaml index 772554fe8b..d0af99fc0c 100644 --- a/api/v1/swagger/paths/erm_eholdings_packages_resources.yaml +++ b/api/v1/swagger/paths/erm_eholdings_packages_resources.yaml @@ -58,8 +58,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_eholdings_resource" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: diff --git a/api/v1/swagger/paths/erm_eholdings_resources.yaml b/api/v1/swagger/paths/erm_eholdings_resources.yaml index 1374a20471..eb2aa6ae31 100644 --- a/api/v1/swagger/paths/erm_eholdings_resources.yaml +++ b/api/v1/swagger/paths/erm_eholdings_resources.yaml @@ -57,8 +57,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_eholdings_resource" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -112,6 +115,10 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_eholdings_resource" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: @@ -173,6 +180,10 @@ description: Add or remove this resource from remote holdings type: boolean additionalProperties: false + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: diff --git a/api/v1/swagger/paths/erm_eholdings_titles.yaml b/api/v1/swagger/paths/erm_eholdings_titles.yaml index d86e2b3914..722acf1499 100644 --- a/api/v1/swagger/paths/erm_eholdings_titles.yaml +++ b/api/v1/swagger/paths/erm_eholdings_titles.yaml @@ -167,8 +167,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_eholdings_title" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -217,7 +220,7 @@ items: $ref: "../swagger.yaml#/definitions/erm_eholdings_title" 400: - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -282,6 +285,10 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_eholdings_title" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: @@ -348,7 +355,7 @@ items: $ref: "../swagger.yaml#/definitions/erm_eholdings_title" 400: - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -395,7 +402,7 @@ 204: description: title deleted 400: - description: title deletion failed + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -461,7 +468,7 @@ type: string additionalProperties: false 400: - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: diff --git a/api/v1/swagger/paths/erm_eholdings_titles_resources.yaml b/api/v1/swagger/paths/erm_eholdings_titles_resources.yaml index 1b30c6a05b..bcef4b4776 100644 --- a/api/v1/swagger/paths/erm_eholdings_titles_resources.yaml +++ b/api/v1/swagger/paths/erm_eholdings_titles_resources.yaml @@ -58,8 +58,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_eholdings_resource" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: diff --git a/api/v1/swagger/paths/erm_licenses.yaml b/api/v1/swagger/paths/erm_licenses.yaml index 6dc6c4ebe6..129ce47048 100644 --- a/api/v1/swagger/paths/erm_licenses.yaml +++ b/api/v1/swagger/paths/erm_licenses.yaml @@ -66,8 +66,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_license" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -111,7 +114,7 @@ items: $ref: "../swagger.yaml#/definitions/erm_license" 400: - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -177,6 +180,10 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_license" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: authentication required schema: @@ -238,7 +245,7 @@ items: $ref: "../swagger.yaml#/definitions/erm_license" 400: - description: bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -284,7 +291,7 @@ 204: description: license deleted 400: - description: license deletion failed + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: diff --git a/api/v1/swagger/paths/erm_sushi_services.yaml b/api/v1/swagger/paths/erm_sushi_services.yaml index 2fd0377565..72ba993cc8 100644 --- a/api/v1/swagger/paths/erm_sushi_services.yaml +++ b/api/v1/swagger/paths/erm_sushi_services.yaml @@ -21,8 +21,11 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_sushi_service" - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: diff --git a/api/v1/swagger/paths/erm_usage_data_providers.yaml b/api/v1/swagger/paths/erm_usage_data_providers.yaml index 9fd3296bf3..238bf37b3f 100644 --- a/api/v1/swagger/paths/erm_usage_data_providers.yaml +++ b/api/v1/swagger/paths/erm_usage_data_providers.yaml @@ -107,8 +107,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_usage_data_provider" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -152,7 +155,7 @@ items: $ref: "../swagger.yaml#/definitions/erm_usage_data_provider" 400: - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -216,6 +219,10 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_usage_data_provider" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: authentication required schema: @@ -273,8 +280,8 @@ schema: items: $ref: "../swagger.yaml#/definitions/erm_usage_data_provider" - 400: - description: bad parameter + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -319,8 +326,8 @@ responses: 204: description: usage_data_provider deleted - 400: - description: usage_data_provider deletion failed + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -491,4 +498,4 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - erm: 1 \ No newline at end of file + erm: 1 diff --git a/api/v1/swagger/paths/erm_usage_databases.yaml b/api/v1/swagger/paths/erm_usage_databases.yaml index adef38cd7c..2717de9110 100644 --- a/api/v1/swagger/paths/erm_usage_databases.yaml +++ b/api/v1/swagger/paths/erm_usage_databases.yaml @@ -64,8 +64,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_usage_database" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -84,4 +87,4 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - erm: 1 \ No newline at end of file + erm: 1 diff --git a/api/v1/swagger/paths/erm_usage_items.yaml b/api/v1/swagger/paths/erm_usage_items.yaml index 78a0fddb6f..1cecbba3a5 100644 --- a/api/v1/swagger/paths/erm_usage_items.yaml +++ b/api/v1/swagger/paths/erm_usage_items.yaml @@ -59,8 +59,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_usage_item" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -79,4 +82,4 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - erm: 1 \ No newline at end of file + erm: 1 diff --git a/api/v1/swagger/paths/erm_usage_platforms.yaml b/api/v1/swagger/paths/erm_usage_platforms.yaml index ad7f81dc70..0c83000a54 100644 --- a/api/v1/swagger/paths/erm_usage_platforms.yaml +++ b/api/v1/swagger/paths/erm_usage_platforms.yaml @@ -49,8 +49,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_usage_platform" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -69,4 +72,4 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - erm: 1 \ No newline at end of file + erm: 1 diff --git a/api/v1/swagger/paths/erm_usage_titles.yaml b/api/v1/swagger/paths/erm_usage_titles.yaml index 246c6147d4..a6c035c904 100644 --- a/api/v1/swagger/paths/erm_usage_titles.yaml +++ b/api/v1/swagger/paths/erm_usage_titles.yaml @@ -89,8 +89,11 @@ items: $ref: "../swagger.yaml#/definitions/erm_usage_title" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: diff --git a/api/v1/swagger/paths/erm_users.yaml b/api/v1/swagger/paths/erm_users.yaml index 2798062416..146f6b2591 100644 --- a/api/v1/swagger/paths/erm_users.yaml +++ b/api/v1/swagger/paths/erm_users.yaml @@ -33,8 +33,11 @@ type: array items: $ref: "../swagger.yaml#/definitions/patron" - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: diff --git a/api/v1/swagger/paths/holds.yaml b/api/v1/swagger/paths/holds.yaml index 6458ff72ef..b75ad24e50 100644 --- a/api/v1/swagger/paths/holds.yaml +++ b/api/v1/swagger/paths/holds.yaml @@ -112,6 +112,13 @@ description: A list of holds schema: $ref: "../swagger.yaml#/definitions/holds" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -224,7 +231,7 @@ schema: $ref: "../swagger.yaml#/definitions/hold" "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -291,7 +298,7 @@ schema: $ref: "../swagger.yaml#/definitions/hold" "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -359,7 +366,7 @@ schema: $ref: "../swagger.yaml#/definitions/hold" "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -413,6 +420,10 @@ description: Hold request recorded "204": description: Hold deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -461,6 +472,10 @@ description: The new priority value for the hold schema: type: integer + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -520,7 +535,7 @@ "201": description: Hold suspended "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -565,7 +580,7 @@ "204": description: Hold resumed "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -630,7 +645,10 @@ items: $ref: "../swagger.yaml#/definitions/library" "400": - description: Missing or wrong parameters + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -693,7 +711,7 @@ description: Internal identifier for the pickup library additionalProperties: false "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": diff --git a/api/v1/swagger/paths/ill_backends.yaml b/api/v1/swagger/paths/ill_backends.yaml index 874481a5ec..eb578c8a9e 100644 --- a/api/v1/swagger/paths/ill_backends.yaml +++ b/api/v1/swagger/paths/ill_backends.yaml @@ -14,6 +14,10 @@ description: A list of ILL backends schema: $ref: "../swagger.yaml#/definitions/ill_backends" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -70,6 +74,10 @@ description: An ILL backends schema: $ref: "../swagger.yaml#/definitions/ill_backend" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -95,4 +103,4 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - ill: "1" \ No newline at end of file + ill: "1" diff --git a/api/v1/swagger/paths/ill_batches.yaml b/api/v1/swagger/paths/ill_batches.yaml index 3d747be2a5..8f0a042ec4 100644 --- a/api/v1/swagger/paths/ill_batches.yaml +++ b/api/v1/swagger/paths/ill_batches.yaml @@ -35,6 +35,13 @@ description: A list of ILL batches schema: $ref: "../swagger.yaml#/definitions/ill_batches" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -170,6 +177,13 @@ description: An ILL batch schema: $ref: "../swagger.yaml#/definitions/ill_batch" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -264,6 +278,10 @@ description: ILL batch deleted schema: type: string + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/ill_batchstatuses.yaml b/api/v1/swagger/paths/ill_batchstatuses.yaml index 235a5600b2..0c75227fc3 100644 --- a/api/v1/swagger/paths/ill_batchstatuses.yaml +++ b/api/v1/swagger/paths/ill_batchstatuses.yaml @@ -14,6 +14,10 @@ description: A list of ILL batch statuses schema: $ref: "../swagger.yaml#/definitions/ill_batchstatuses" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -110,6 +114,10 @@ description: An ILL batch status schema: $ref: "../swagger.yaml#/definitions/ill_batchstatus" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -204,6 +212,10 @@ description: ILL batch status deleted schema: type: string + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/ill_requests.yaml b/api/v1/swagger/paths/ill_requests.yaml index f67606dc56..e6bc07baa2 100644 --- a/api/v1/swagger/paths/ill_requests.yaml +++ b/api/v1/swagger/paths/ill_requests.yaml @@ -41,6 +41,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/ill_request" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: diff --git a/api/v1/swagger/paths/import_batch_profiles.yaml b/api/v1/swagger/paths/import_batch_profiles.yaml index 958b486de6..513c0c7a9d 100644 --- a/api/v1/swagger/paths/import_batch_profiles.yaml +++ b/api/v1/swagger/paths/import_batch_profiles.yaml @@ -28,6 +28,13 @@ description: A list of import batch profiles schema: $ref: "../swagger.yaml#/definitions/import_batch_profiles" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -128,7 +135,7 @@ schema: $ref: "../swagger.yaml#/definitions/import_batch_profile" "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -237,7 +244,7 @@ schema: $ref: "../swagger.yaml#/definitions/import_batch_profile" "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -279,6 +286,10 @@ responses: "204": description: Profile deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/import_batches.yaml b/api/v1/swagger/paths/import_batches.yaml index 0fe737a040..9b205d095c 100644 --- a/api/v1/swagger/paths/import_batches.yaml +++ b/api/v1/swagger/paths/import_batches.yaml @@ -36,7 +36,7 @@ "200": description: Match updated "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -87,6 +87,10 @@ responses: "204": description: Matches unchosen + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/item_types.yaml b/api/v1/swagger/paths/item_types.yaml index d359a40d62..0d2bbb206a 100644 --- a/api/v1/swagger/paths/item_types.yaml +++ b/api/v1/swagger/paths/item_types.yaml @@ -32,8 +32,11 @@ items: $ref: "../swagger.yaml#/definitions/item_type" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: diff --git a/api/v1/swagger/paths/items.yaml b/api/v1/swagger/paths/items.yaml index 3f4677a9a3..62209a4eda 100644 --- a/api/v1/swagger/paths/items.yaml +++ b/api/v1/swagger/paths/items.yaml @@ -41,6 +41,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/item" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -92,7 +99,7 @@ schema: $ref: "../swagger.yaml#/definitions/item" "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "404": @@ -129,7 +136,7 @@ "204": description: Deleted item "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "403": @@ -191,7 +198,7 @@ items: $ref: "../swagger.yaml#/definitions/item" "400": - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -265,6 +272,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/item" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -306,7 +320,7 @@ "204": description: Bundle link deleted "400": - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "409": @@ -363,9 +377,12 @@ items: $ref: ../swagger.yaml#/definitions/booking "400": - description: Missing or wrong parameters + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: - $ref: ../swagger.yaml#/definitions/error + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -422,7 +439,10 @@ items: $ref: "../swagger.yaml#/definitions/library" "400": - description: Missing or wrong parameters + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -493,6 +513,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/item" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/jobs.yaml b/api/v1/swagger/paths/jobs.yaml index 8fe7e04841..7edd87dad2 100644 --- a/api/v1/swagger/paths/jobs.yaml +++ b/api/v1/swagger/paths/jobs.yaml @@ -28,6 +28,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/job" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -62,6 +69,10 @@ description: A job schema: $ref: "../swagger.yaml#/definitions/job" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: diff --git a/api/v1/swagger/paths/libraries.yaml b/api/v1/swagger/paths/libraries.yaml index 30dbaa0d7c..dc80691eab 100644 --- a/api/v1/swagger/paths/libraries.yaml +++ b/api/v1/swagger/paths/libraries.yaml @@ -115,6 +115,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/library" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "500": description: | Internal server error. Possible `error_code` attribute values: @@ -207,6 +214,10 @@ description: A library schema: $ref: "../swagger.yaml#/definitions/library" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: Library not found schema: @@ -282,6 +293,10 @@ description: Library deleted schema: type: string + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -332,6 +347,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/desk" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" 404: description: Resource not found schema: @@ -374,6 +396,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/cash_register" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" 404: description: Resource not found schema: @@ -416,6 +445,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/library" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "500": description: | Internal server error. Possible `error_code` attribute values: @@ -441,6 +477,10 @@ responses: "200": description: A library + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/oauth.yaml b/api/v1/swagger/paths/oauth.yaml index 2b3f2fb029..27e08379fc 100644 --- a/api/v1/swagger/paths/oauth.yaml +++ b/api/v1/swagger/paths/oauth.yaml @@ -36,7 +36,7 @@ type: integer additionalProperties: false "400": - description: Bad Request + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "403": @@ -108,7 +108,7 @@ schema: type: string "400": - description: Bad Request + description: Bad request schema: $ref: ../swagger.yaml#/definitions/error "403": diff --git a/api/v1/swagger/paths/patron_categories.yaml b/api/v1/swagger/paths/patron_categories.yaml index 85f57872e8..98d261e070 100644 --- a/api/v1/swagger/paths/patron_categories.yaml +++ b/api/v1/swagger/paths/patron_categories.yaml @@ -23,6 +23,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/patron_category" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/patrons.yaml b/api/v1/swagger/paths/patrons.yaml index 9c3e5ccaa8..f9ddf4c49b 100644 --- a/api/v1/swagger/paths/patrons.yaml +++ b/api/v1/swagger/paths/patrons.yaml @@ -372,6 +372,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/patron" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -434,7 +441,13 @@ items: $ref: "../swagger.yaml#/definitions/patron" "400": - description: Bad parameter + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_attribute_type` + * `attribute_not_unique` + * `non_repeatable_attribute` + * `missing_mandatory_attribute` schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -494,6 +507,10 @@ description: A patron schema: $ref: "../swagger.yaml#/definitions/patron" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -546,7 +563,13 @@ items: $ref: "../swagger.yaml#/definitions/patron" "400": - description: Bad parameter + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_attribute_type` + * `attribute_not_unique` + * `non_repeatable_attribute` + * `missing_mandatory_attribute` schema: $ref: "../swagger.yaml#/definitions/error" "403": @@ -589,7 +612,7 @@ "204": description: Patron deleted "400": - description: Patron deletion failed + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": diff --git a/api/v1/swagger/paths/patrons_account.yaml b/api/v1/swagger/paths/patrons_account.yaml index eaf96e9107..1ebdf8b883 100644 --- a/api/v1/swagger/paths/patrons_account.yaml +++ b/api/v1/swagger/paths/patrons_account.yaml @@ -15,6 +15,10 @@ description: Patron's account balance schema: $ref: "../swagger.yaml#/definitions/patron_balance" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -66,6 +70,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/credit" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -103,6 +114,10 @@ description: Credit added schema: $ref: "../swagger.yaml#/definitions/account_line" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -153,6 +168,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/debit" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -195,7 +217,7 @@ schema: $ref: "../swagger.yaml#/definitions/debit" "400": - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": diff --git a/api/v1/swagger/paths/patrons_checkouts.yaml b/api/v1/swagger/paths/patrons_checkouts.yaml index b5d3563426..4a0b64d77d 100644 --- a/api/v1/swagger/paths/patrons_checkouts.yaml +++ b/api/v1/swagger/paths/patrons_checkouts.yaml @@ -34,6 +34,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/checkout" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/patrons_extended_attributes.yaml b/api/v1/swagger/paths/patrons_extended_attributes.yaml index 3d0ffc561c..18d33c10c1 100644 --- a/api/v1/swagger/paths/patrons_extended_attributes.yaml +++ b/api/v1/swagger/paths/patrons_extended_attributes.yaml @@ -24,6 +24,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/patron_extended_attribute" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -72,7 +79,7 @@ schema: $ref: "../swagger.yaml#/definitions/patron_extended_attribute" "400": - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -131,7 +138,7 @@ items: $ref: "../swagger.yaml#/definitions/patron_extended_attribute" "400": - description: Bad parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -198,7 +205,7 @@ schema: $ref: "../swagger.yaml#/definitions/patron_extended_attribute" "400": - description: Bad parameter + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -249,6 +256,10 @@ responses: "204": description: Extended patron attribute deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/patrons_holds.yaml b/api/v1/swagger/paths/patrons_holds.yaml index c8a4750b91..1915f42734 100644 --- a/api/v1/swagger/paths/patrons_holds.yaml +++ b/api/v1/swagger/paths/patrons_holds.yaml @@ -43,6 +43,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/hold" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/patrons_recalls.yaml b/api/v1/swagger/paths/patrons_recalls.yaml index c4b2d994da..f99d73eafc 100644 --- a/api/v1/swagger/paths/patrons_recalls.yaml +++ b/api/v1/swagger/paths/patrons_recalls.yaml @@ -24,6 +24,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/recall" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/preservation_processings.yaml b/api/v1/swagger/paths/preservation_processings.yaml index eac8f25955..6c66d122a0 100644 --- a/api/v1/swagger/paths/preservation_processings.yaml +++ b/api/v1/swagger/paths/preservation_processings.yaml @@ -32,8 +32,11 @@ items: $ref: "../swagger.yaml#/definitions/preservation_processing" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -76,8 +79,8 @@ schema: items: $ref: "../swagger.yaml#/definitions/preservation_processing" - 400: - description: Bad parameter + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -140,6 +143,10 @@ schema: items: $ref: "../swagger.yaml#/definitions/preservation_processing" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: @@ -190,8 +197,8 @@ schema: items: $ref: "../swagger.yaml#/definitions/preservation_processing" - 400: - description: Bad parameter + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -236,8 +243,8 @@ responses: 204: description: processing deleted - 400: - description: processing deletion failed + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: diff --git a/api/v1/swagger/paths/preservation_trains.yaml b/api/v1/swagger/paths/preservation_trains.yaml index 9644581fd7..76cf7250bf 100644 --- a/api/v1/swagger/paths/preservation_trains.yaml +++ b/api/v1/swagger/paths/preservation_trains.yaml @@ -62,8 +62,11 @@ items: $ref: "../swagger.yaml#/definitions/preservation_train" type: array - 400: - description: Bad request + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -107,8 +110,8 @@ schema: items: $ref: "../swagger.yaml#/definitions/preservation_train" - 400: - description: Bad parameter + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -178,6 +181,10 @@ schema: items: $ref: "../swagger.yaml#/definitions/preservation_train" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: @@ -228,8 +235,8 @@ schema: items: $ref: "../swagger.yaml#/definitions/preservation_train" - 400: - description: Bad parameter + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -275,8 +282,8 @@ responses: 204: description: Train deleted - 400: - description: Train deletion failed + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -333,8 +340,8 @@ description: A successfully added item schema: $ref: "../swagger.yaml#/definitions/preservation_train_item" - 400: - description: Bad parameter + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -399,8 +406,8 @@ type: array items: type: object - 400: - description: Bad parameter + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -472,8 +479,8 @@ description: A successfully updated item schema: $ref: "../swagger.yaml#/definitions/preservation_train_item" - 400: - description: Bad parameter + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 403: @@ -521,7 +528,7 @@ "204": description: Item removed "400": - description: Item removal failed + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -578,6 +585,10 @@ description: An item in train schema: $ref: "../swagger.yaml#/definitions/preservation_train_item" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" 401: description: Authentication required schema: @@ -635,8 +646,8 @@ description: A successfully copied item schema: $ref: "../swagger.yaml#/definitions/preservation_train_item" - 400: - description: Bad parameter + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: diff --git a/api/v1/swagger/paths/preservation_waiting_list.yaml b/api/v1/swagger/paths/preservation_waiting_list.yaml index 26f1ef6548..ee5074288b 100644 --- a/api/v1/swagger/paths/preservation_waiting_list.yaml +++ b/api/v1/swagger/paths/preservation_waiting_list.yaml @@ -41,7 +41,10 @@ items: $ref: "../swagger.yaml#/definitions/item" "400": - description: Bad parameter + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -92,8 +95,8 @@ type: array items: type: object - 400: - description: Bad parameter + "400": + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" 401: @@ -145,7 +148,7 @@ "204": description: Item removed "400": - description: Item removal failed + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": diff --git a/api/v1/swagger/paths/public_oauth.yaml b/api/v1/swagger/paths/public_oauth.yaml index 80ac4e3741..75bcd10666 100644 --- a/api/v1/swagger/paths/public_oauth.yaml +++ b/api/v1/swagger/paths/public_oauth.yaml @@ -63,9 +63,12 @@ schema: type: string "400": - description: Bad Request + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: - $ref: ../swagger.yaml#/definitions/error + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: diff --git a/api/v1/swagger/paths/public_patrons.yaml b/api/v1/swagger/paths/public_patrons.yaml index cda6d2a342..2f2526e827 100644 --- a/api/v1/swagger/paths/public_patrons.yaml +++ b/api/v1/swagger/paths/public_patrons.yaml @@ -91,7 +91,7 @@ schema: $ref: "../swagger.yaml#/definitions/checkout" "400": - description: Missing or wrong parameters + description: Bad request schema: $ref: "../swagger.yaml#/definitions/error" "401": diff --git a/api/v1/swagger/paths/quotes.yaml b/api/v1/swagger/paths/quotes.yaml index 901b7af933..c502fe3722 100644 --- a/api/v1/swagger/paths/quotes.yaml +++ b/api/v1/swagger/paths/quotes.yaml @@ -43,6 +43,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/quote" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -81,6 +88,10 @@ description: Quote added schema: $ref: "../swagger.yaml#/definitions/quote" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -119,6 +130,10 @@ description: A Quote schema: $ref: "../swagger.yaml#/definitions/quote" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: Quote not found schema: @@ -158,6 +173,10 @@ description: A quote schema: $ref: "../swagger.yaml#/definitions/quote" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -197,6 +216,10 @@ responses: "204": description: Quote deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/search_filters.yaml b/api/v1/swagger/paths/search_filters.yaml index 1948ad86af..02224e618e 100644 --- a/api/v1/swagger/paths/search_filters.yaml +++ b/api/v1/swagger/paths/search_filters.yaml @@ -23,6 +23,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/search_filter" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" '403': description: Access forbidden schema: @@ -58,6 +65,10 @@ description: Search filter added schema: $ref: "../swagger.yaml#/definitions/search_filter" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" '401': description: Authentication required schema: @@ -97,6 +108,10 @@ description: A search filter schema: $ref: "../swagger.yaml#/definitions/search_filter" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" '403': description: Access forbidden schema: @@ -137,6 +152,10 @@ description: An search_filter schema: $ref: "../swagger.yaml#/definitions/search_filter" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" '401': description: Authentication required schema: @@ -175,6 +194,10 @@ description: Searc filter deleted schema: type: string + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" '401': description: Authentication required schema: diff --git a/api/v1/swagger/paths/suggestions.yaml b/api/v1/swagger/paths/suggestions.yaml index 6e500bcf4c..a17d5d1ac8 100644 --- a/api/v1/swagger/paths/suggestions.yaml +++ b/api/v1/swagger/paths/suggestions.yaml @@ -24,6 +24,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/suggestion" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -118,6 +125,10 @@ description: A suggestion schema: $ref: "../swagger.yaml#/definitions/suggestion" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -204,6 +215,10 @@ description: Suggestion deleted schema: type: string + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -264,6 +279,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/patron" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: diff --git a/api/v1/swagger/paths/tickets.yaml b/api/v1/swagger/paths/tickets.yaml index a0d0e2a759..d85eb3e095 100644 --- a/api/v1/swagger/paths/tickets.yaml +++ b/api/v1/swagger/paths/tickets.yaml @@ -36,6 +36,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/ticket" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -74,6 +81,10 @@ description: Ticket added schema: $ref: "../swagger.yaml#/definitions/ticket" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -112,6 +123,13 @@ description: A ticket schema: $ref: "../swagger.yaml#/definitions/ticket" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "404": description: Ticket not found schema: @@ -151,6 +169,10 @@ description: A ticket schema: $ref: "../swagger.yaml#/definitions/ticket" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -187,6 +209,10 @@ responses: "204": description: Ticket deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -245,6 +271,13 @@ type: array items: $ref: "../swagger.yaml#/definitions/ticket_update" + "400": + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` + schema: + $ref: "../swagger.yaml#/definitions/error" "403": description: Access forbidden schema: @@ -288,6 +321,10 @@ description: Ticket added schema: $ref: "../swagger.yaml#/definitions/ticket_update" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -332,6 +369,10 @@ description: Ticket added schema: $ref: "../swagger.yaml#/definitions/ticket" + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/api/v1/swagger/paths/transfer_limits.yaml b/api/v1/swagger/paths/transfer_limits.yaml index e6f6018602..74ad2c8b6a 100644 --- a/api/v1/swagger/paths/transfer_limits.yaml +++ b/api/v1/swagger/paths/transfer_limits.yaml @@ -44,7 +44,10 @@ items: $ref: "../swagger.yaml#/definitions/transfer_limit" "400": - description: Bad request + description: | + Bad request. Possible `error_code` attribute values: + + * `invalid_query` schema: $ref: "../swagger.yaml#/definitions/error" "401": @@ -138,6 +141,10 @@ description: Transfer limit deleted schema: type: string + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: @@ -313,6 +320,10 @@ responses: "204": description: Transfer limits deleted + "400": + description: Bad request + schema: + $ref: "../swagger.yaml#/definitions/error" "401": description: Authentication required schema: diff --git a/t/db_dependent/api/v1/query.t b/t/db_dependent/api/v1/query.t index 353760ca99..f807f21ea2 100755 --- a/t/db_dependent/api/v1/query.t +++ b/t/db_dependent/api/v1/query.t @@ -171,7 +171,7 @@ subtest 'SQL injection in "query" handling' => sub { "[{\"-and\":[[{\"me.patron_id\":{\"like(IF(ASCII(SUBSTRING((SELECT version()),1,1))=ASCII('1'),SLEEP(1/100000),0))or\":\"\%a\%\"}}]]}]"; $t->get_ok("//$userid:$password@/api/v1/patrons?q=$q") - ->status_is( 500, 'Attempt to inject SQL through operators is rejected' ); + ->status_is( 400, 'Attempt to inject SQL through operators is rejected' ); $schema->storage->txn_rollback; }; diff --git a/xt/api.t b/xt/api.t index 3165f8ff6e..da12d5b2a9 100755 --- a/xt/api.t +++ b/xt/api.t @@ -14,7 +14,7 @@ use Modern::Perl; -use Test::More tests => 4; +use Test::More tests => 5; use Test::Mojo; use Data::Dumper; @@ -128,3 +128,46 @@ subtest 'tags tests' => sub { print STDERR "$error\n"; } }; + +subtest '400 response tests' => sub { + + plan tests => 1; + + my @errors; + + foreach my $route ( sort keys %{$paths} ) { + foreach my $verb ( keys %{ $paths->{$route} } ) { + + my $response_400 = $paths->{$route}->{$verb}->{responses}->{400}; + + if ( !$response_400 ) { + push @errors, "$verb $route -> response 400 absent"; + next; + } + + push @errors, + "$verb $route -> 'description' does not start with 'Bad request': ($response_400->{description})" + unless $response_400->{description} =~ /^Bad request/; + + my $ref = $response_400->{schema}->{'$ref'}; + push @errors, "$verb $route -> '\$ref' is not '#/definitions/error': ($ref)" + unless $ref =~ m/^#\/definitions\/error/; + + # GET routes with q parameter must mention the `invalid_query` error code + if ( ( any { $_->{in} eq 'body' && $_->{name} eq 'query' } @{ $paths->{$route}->{$verb}->{parameters} } ) + || ( any { $_->{in} eq 'query' && $_->{name} eq 'q' } @{ $paths->{$route}->{$verb}->{parameters} } ) ) + { + + push @errors, + "$verb $route -> 'description' does not include '* \`invalid_query\`': ($response_400->{description})" + unless $response_400->{description} =~ /\* \`invalid_query\`/; + } + } + } + + is( scalar @errors, 0, 'No errors in 400 definitions in the spec' ); + + foreach my $error (@errors) { + print STDERR "$error\n"; + } +}; -- 2.39.5