https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23998
--- Comment #45 from Tomás Cohen Arazi (tcohen) <[email protected]> --- Created attachment 208929 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208929&action=edit Bug 23998: (follow-up) Make the messages spec follow the API guidelines This patch fixes several API guideline violations in the /messages spec: - `message_id` is marked readOnly in the `message` definition, and removed from `message_patch`. Clients could previously set it on POST and change the primary key on PUT/PATCH. Posting an existing id now returns 400 (as /cities does) instead of 409. - `message_type` is restricted to the valid values (L and B) instead of `maxLength: 1`, which accepted empty strings and any character. - `message` gets `minLength: 1`. - GET /messages now accepts the standard `_match`, `_order_by`, `_page`, `_per_page`, `q` and `x-koha-request-id` parameters. Pagination, sorting and `q` queries were rejected with 400. - 401/403 responses are documented on GET routes, and the possible `error_code` values for 400 on list. - Reading messages requires `list_borrowers`, as for /patrons. The permission list was an OR, so `view_borrower_infos_from_any_libraries` alone granted access. - Misleading 'case insensitive' descriptions on date/id params fixed. TestBuilder now defaults `message_type` to 'B' for the Message source, as random strings fail response validation. Test plan: 1. Apply this patch 2. Run: $ ktd --shell k$ yarn api:bundle k$ restart_all k$ prove t/db_dependent/api/v1/messages.t \ t/db_dependent/Koha/Patron/Messages.t \ t/db_dependent/TestBuilder.t \ xt/api.t => SUCCESS: Tests pass! 3. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
