[Koha-bugs] [Bug 33556] New: $c->validation->output should be avoided

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Apr 18 14:32:15 CEST 2023


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

            Bug ID: 33556
           Summary: $c->validation->output should be avoided
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: REST API
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: tomascohen at gmail.com
                CC: tomascohen at gmail.com

Talking to the OpenAPI plugin maintainer, he mentioned the use of
$c->validation->output should be avoided as the plugin is not designed to have
a stable behavior there, and he even thought of just removing the method.

That method returns an internal data structure the plugin uses to validate
things, and then updates the request itself.

Take the following example:

GET /patrons
x-koha-embed: checkouts,library

without the OpenAPI plugin, requesting the header like this:

$c->req->headers->header('x-koha-embed')

would return a scalar, the string 'checkouts,library'.

When using the plugin, and with `x-koha-embed` being defined as
collectionFormat: csv, that header is entirely replaced by an arrayref.

That's how the plugin works and how it is expected to be used. So we need to
replace the uses of $c->validation->format, with normal Mojo usage to avoid
future headaches.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list