Koha/api/v1/swagger/paths/import_batches.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

119 lines
3.3 KiB
YAML

---
"/import_batches/{import_batch_id}/records/{import_record_id}/matches/chosen":
put:
x-mojo-to: ImportRecordMatches#set_chosen
operationId: setChosen
summary: Set the chosen match for an import record ID
tags:
- import_batches
parameters:
- name: import_batch_id
in: path
required: true
description: An import_batch ID
type: integer
- name: import_record_id
in: path
required: true
description: An import_record ID
type: integer
- name: body
in: body
description: A JSON object containing fields to modify
required: true
schema:
type: object
properties:
candidate_match_id:
description: Candidate match to choose
type: integer
additionalProperties: false
consumes:
- application/json
produces:
- application/json
responses:
"200":
description: Match updated
"400":
description: Bad request
schema:
$ref: "../swagger.yaml#/definitions/error"
"401":
description: Authentication required
schema:
$ref: "../swagger.yaml#/definitions/error"
"403":
description: Match management not allowed
schema:
$ref: "../swagger.yaml#/definitions/error"
"404":
description: Import record match not found
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:
tools: manage_staged_marc
delete:
x-mojo-to: ImportRecordMatches#unset_chosen
operationId: unsetChosen
summary: Unset the chosen match for an import record ID
tags:
- import_batches
parameters:
- name: import_batch_id
in: path
required: true
description: An import_batch ID
type: integer
- name: import_record_id
in: path
required: true
description: An import_record ID
type: integer
produces:
- application/json
responses:
"204":
description: Matches unchosen
"400":
description: Bad request
schema:
$ref: "../swagger.yaml#/definitions/error"
"401":
description: Authentication required
schema:
$ref: "../swagger.yaml#/definitions/error"
"403":
description: Match management not allowed
schema:
$ref: "../swagger.yaml#/definitions/error"
"404":
description: Import record matches not found
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:
tools: manage_staged_marc