[Koha-bugs] [Bug 17932] Koha::Object should provide a TO_JSON method

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jan 23 16:48:21 CET 2017


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

--- Comment #3 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Created attachment 59432
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59432&action=edit
Bug 17932: (followup) Fix /patrons endpoint

Bug 17927 introduced data type fixes on the /patrons endpoint (integer
and boolean types got fixed). This led to the /patrons endpoint not to
work because the underlying code didn't provide the right data.

With the introduction of TO_JSON on Koha::Object(s) we now have a way to
output the proper data types.

This patch does so by:
- Adding is_boolean => 1 to the relevant columns on the Borrower.pm
  schema file.
- Tweaking the controller class for the /patrons endpoint so it doesn't
  use the $object(s)->unblessed call but just let the Mojo::JSON library
  pick out TO_JSON implementation instead on rendering the output.
- It adds a new test for booleans.

To test:
- Have 17927 applied
- Run:
  $ prove t/db_dependent/api/v1/patrons.t
=> FAIL: Tests fail [1]
- Apply this patches
- Run:
  $ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
- Sign off! :-D

[1] It is self explanatory to just try the API using any of the
available tools (I use HttpRequester on Firefox)

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


More information about the Koha-bugs mailing list