Koha/api/v1/swagger/paths/erm_usage_items.yaml
Tomas Cohen Arazi 35e9ac9b0a
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>
2024-08-01 17:26:44 +02:00

85 lines
2.5 KiB
YAML

---
/erm/usage_items:
get:
x-mojo-to: ERM::EUsage::UsageItems#list
operationId: listErmUsageItems
tags:
- erm_usage_items
summary: List usage_items
produces:
- application/json
parameters:
- description: Case insensitive search on usage_item item_id
in: query
name: item_id
required: false
type: integer
- description: Case insensitive search on usage_item item
in: query
name: item
required: false
type: string
- description: Case insensitive search on usage_item usage_data_provider_id
in: query
name: usage_data_provider_id
required: false
type: string
- description: Case insensitive search on usage_item platform
in: query
name: platform
required: false
type: string
- description: Case insensitive search on usage_item publisher
in: query
name: publisher
required: false
type: string
- name: x-koha-embed
in: header
required: false
description: Embed list sent as a request header
type: array
items:
type: string
enum:
- erm_usage_muses
- erm_usage_yuses
collectionFormat: csv
- $ref: "../swagger.yaml#/parameters/match"
- $ref: "../swagger.yaml#/parameters/order_by"
- $ref: "../swagger.yaml#/parameters/page"
- $ref: "../swagger.yaml#/parameters/per_page"
- $ref: "../swagger.yaml#/parameters/q_param"
- $ref: "../swagger.yaml#/parameters/q_body"
- $ref: "../swagger.yaml#/parameters/request_id_header"
responses:
200:
description: A list of usage_items
schema:
items:
$ref: "../swagger.yaml#/definitions/erm_usage_item"
type: array
"400":
description: |
Bad request. Possible `error_code` attribute values:
* `invalid_query`
schema:
$ref: "../swagger.yaml#/definitions/error"
403:
description: Access forbidden
schema:
$ref: "../swagger.yaml#/definitions/error"
500:
description: |-
Internal server error. Possible `error_code` attribute values:
* `internal_server_error`
schema:
$ref: "../swagger.yaml#/definitions/error"
503:
description: Under maintenance
schema:
$ref: "../swagger.yaml#/definitions/error"
x-koha-authorization:
permissions:
erm: 1