https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44034
Bug ID: 44034
Summary: Move parse_xml and to_xml out of Koha::REST::V1 into
Koha::Util::XML
Initiative type: ---
Sponsorship ---
status:
Product: Koha
Version: Main
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5 - low
Component: Architecture, internals, and plumbing
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
Target Milestone: ---
parse_xml and to_xml convert between XML (XML::LibXML) and plain Perl data
structures. They were added to Koha::REST::V1 by bug 37762 for the REST API's
XML handling, but nothing about them is REST-specific.
Their only callers outside Koha::REST::V1 are the ISO18626 ILL modules
(Koha::ILL::ISO18626 and Koha::ILL::ISO18626::Request). Request uses them when
it sends a message to a requesting agency's callback endpoint and parses the
reply, so no REST controller is involved. Today those modules have to load the
entire REST application to reach two helper functions, and the dependency
points the wrong way: domain code depending on the API layer.
Proposal:
- Add Koha::Util::XML (alongside Koha::Util::MARC, Koha::Util::Normalize and
friends) exporting parse_xml and to_xml, with their behaviour unchanged.
- Point the ISO18626 modules at it, and have Koha::REST::V1 import them for its
existing hooks.
- Let parse_xml take an already-loaded definitions hashref as well as a spec
file path. The path form resolves the whole spec and caches it per process,
which is wasteful for callers that already hold the spec.
No functional change is intended.
Out of scope, noted for later:
- The bundle-or-yaml spec file lookup is repeated in
Koha::ILL::ISO18626::is_invalid and twice in Request.pm. Two of those feed
schema validation and not parse_xml, so it needs its own home and is not an XML
util concern.
- to_xml takes the first key of the hash as the root element, so a hash with
several keys gives an arbitrary root. This should be addressed separately,
either by dying or by taking a root name.
--
You are receiving this mail because:
You are the assignee for the bug.
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/