Koha/api/v1/swagger/paths/patrons_password.yaml
Tomas Cohen Arazi a3aaf10e59 Bug 29926: (QA follow-up) Date format missing in spec
On fixing the spec to have `format: date` I noticed the tests were
expecting explosions because of date handling not being done. The
OpenAPI plugin does this correctly when you set the format right.

So, I adapted the tests so they expect 400 and return the type error.

We don't usually add such tests (i.e. test the plugin does its job
correctly) but it doesn't hurt to keep them just in case something
really changes badly there (plugin bug?).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-05-06 10:33:10 -10:00

118 lines
3.3 KiB
YAML

---
"/patrons/{patron_id}/password":
post:
x-mojo-to: Patrons::Password#set
operationId: setPatronPassword
tags:
- patrons
summary: Set password for a patron
parameters:
- $ref: "../swagger.yaml#/parameters/patron_id_pp"
- name: body
in: body
description: A JSON object containing password information
schema:
type: object
properties:
password:
description: New password (plain text)
type: string
password_2:
description: Repeated new password (plain text)
type: string
required:
- password
- password_2
additionalProperties: false
produces:
- application/json
responses:
"200":
description: Password changed
"400":
description: Bad request
schema:
$ref: "../swagger.yaml#/definitions/error"
"401":
description: Authentication required
schema:
$ref: "../swagger.yaml#/definitions/error"
"403":
description: Access forbidden
schema:
$ref: "../swagger.yaml#/definitions/error"
"404":
description: Patron 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:
borrowers: "1"
"/patrons/{patron_id}/password/expiration_date":
put:
x-mojo-to: Patrons::Password::Expiration#set
operationId: setPatronPasswordExpiration
tags:
- patrons
summary: Set password expiration for a patron
parameters:
- $ref: ../swagger.yaml#/parameters/patron_id_pp
- name: body
in: body
description: A JSON object containing password expiration date
schema:
type: object
properties:
expiration_date:
description: Date to expire password
type: string
format: date
required:
- expiration_date
additionalProperties: false
produces:
- application/json
responses:
"200":
description: Password expiration changed
"400":
description: Bad request
schema:
$ref: ../swagger.yaml#/definitions/error
"401":
description: Authentication required
schema:
$ref: ../swagger.yaml#/definitions/error
"403":
description: Access forbidden
schema:
$ref: ../swagger.yaml#/definitions/error
"404":
description: Patron 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:
superlibrarian: "1"