[Koha-devel] PUT /holds/:hold_id

Tomas Cohen Arazi tomascohen at gmail.com
Mon May 17 23:05:10 CEST 2021


Hi all, I wanted to gather some opinions about the mentioned route.

We've made sure all routes have the additionalProperties: false setting,
and some routes, like this one, don't have it. In the task to add it we
noticed:
1. Theroute doesn't work as expected: the documented attributes don't match
the coding guidelines (i.e. terminology hasn't been adjusted on the spec)
but it did in the code, it just works because we don't set
additionalProperties: false. TL;DR no one following the spec can use it.
2. The route seems to be wrong regarding how our RESTful implementation
works in the rest of the routes: PUT should get a Koha::Hold object for
updating it. Instead, it only 'accepts': 'priority', 'pickup_library_id'
and 'suspended_until'. If we wanted to allow to selectively change those
attributes, we should do a PATCH instead.
3. We already have individual routes for changing those things on the hold:
PUT /holds/:hold_id/pickup_location
PUT /holds/:hold_id/priority
POST /holds/:hold_id/suspension

The route itself doesn't work now. And any change will break things for
people 'using' it. And tests pass only because the spec is loose. The
options are:
- 'Fix' the route so the attributes match the code, i.e. change the spec as
bug 20006 intended to do.
- Leave it as-is (probably documenting it should not be used).
- Remove the route until we really need to implement that PUT for something.
- Make it a PATCH route, in which we could add new attributes without
breaking anyone's dev (besides the verb change, that should be advertised)
- Fully implement a PUT, making it mandatory to send all the attributes
(this would be an important breaking change).

I would vote removing it, or making it a PATCH route. But I still don't see
the use case in the UI, for the latter. Most places in Koha do atomic
updates for priority, pickup location or hold suspension for which we
clearly have routes already.

Looking forward to your comments.

-- 
Tomás Cohen Arazi
Theke Solutions (http://theke.io)
✆ +54 9351 3513384
GPG: B2F3C15F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20210517/20c74819/attachment.htm>


More information about the Koha-devel mailing list