[Bug 43460] New: REST API XML payload conversion breaks plugin API routes that consume XML
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43460 Bug ID: 43460 Summary: REST API XML payload conversion breaks plugin API routes that consume XML Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: kyle@bywatersolutions.com QA Contact: tomascohen@gmail.com CC: tomascohen@gmail.com Target Milestone: --- Bug 37762 makes the REST API convert request bodies sent with an application/xml content type to JSON so they can be validated against Koha's swagger definitions, and convert response bodies with an application/xml content type from JSON to XML. Both hooks apply to every route, including the /contrib plugin routes. Plugins define their own API contracts and may read and output XML directly. For example, the POC for the NCIP server plugin accepts XML messages on its route. On Koha 26.05 and later the request hook replaces the incoming NCIP message with a JSON rendering of it before the plugin controller runs, destroying the message such that element attributes and ordering are lost with no way to get to that data. The response hook then dies trying to parse the plugin's XML response as JSON, turning it into a 500. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43460 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |37762 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37762 [Bug 37762] Expand ILL to allow for supplying agency/lending library workflows -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43460 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |kyle@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43460 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43460 --- Comment #1 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Created attachment 204964 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204964&action=edit Bug 43460: Let API routes skip the global XML<->JSON conversion hooks Koha::REST::V1's hooks convert every route's XML body to JSON and back, breaking plugin routes with native XML protocols like NCIP. A route can now set x-koha-raw-payload in its OpenAPI spec to opt out of both conversions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43460 --- Comment #2 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Created attachment 204965 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204965&action=edit Bug 43460: Add tests for x-koha-raw-payload Adds echo_raw and echo_converted routes to the Test plugin fixture, one setting x-koha-raw-payload and one without it, both echoing the request body. Posts a real NCIP-style XML message with attributes through Koha::REST::V1 via Test::Mojo: the flagged route returns the exact bytes sent, while the default route shows the controller only sees the body after attributes were silently dropped by the XML<->JSON conversion. prove t/db_dependent/Koha/REST/V1.t Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43460 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pedro.amorim@openfifth.co.u | |k --- Comment #3 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Hi Kyle, apologies in advance for the trouble this may have caused / is causing. I did not notice you had assigned this to yourself and gave this a go myself. Please let me know if you agree with the approach! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43460 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|kyle@bywatersolutions.com |pedro.amorim@openfifth.co.u | |k -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43460 --- Comment #4 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- *** Bug 43491 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org