https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44036

            Bug ID: 44036
           Summary: Consolidate how the REST API spec file is located and
                    loaded outside Koha::REST::V1
   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: ---

The REST API spec file (api/v1/swagger/swagger_bundle.json, falling back to
swagger.yaml) is located and loaded independently in several places:

- Koha::REST::V1 (startup), relative to the application home.
- Koha::ILL::ISO18626::is_invalid, to validate a message against a definition.
- Koha::ILL::ISO18626::Request, once to validate a supplying agency message and
once to find the definitions used to parse an agency's XML reply (via
Koha::Util::XML::parse_xml).

The ILL modules each do their own dirname(__FILE__) .
"/../../api/v1/swagger/..." dance and repeat the same "bundle if it exists,
otherwise the yaml" check. They also each resolve the whole spec again, which
is slow, and parse_xml keeps its own per-process cache to compensate.

Proposal: one place that knows where the spec lives and can hand out the
resolved schema (and its definitions) once per process, and have the ILL
modules, and anything else outside the REST app that needs the spec, use it.
Suggestions for where it should live are welcome. It should not be an XML util,
since two of the three ILL uses are about schema validation and not about XML.

This is a cleanup, no functional change is intended.

Raised while working on bug 44034, which moves parse_xml and to_xml to
Koha::Util::XML.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
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/

Reply via email to