Bug 17926 - REST API: Boolean values should be coerced
Summary: REST API: Boolean values should be coerced
Status: RESOLVED DUPLICATE of bug 17932
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-17 17:54 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2017-01-18 18:27 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2017-01-17 17:54:32 UTC
We need to coerce boolean values so they are converted to JSON boolean values by JSON::Validator instead of just passing the '1' and '0' strings.

Steps to reproduce:
- Have a patron with 'Lost card' set to 'Yes'.
- Open your favourite REST testing tool (HttpRequester on Firefox for example)
- Point it to http://localhost:8081/api/v1/patrons/16
(assuming your borrowernumber is 16)
=> FAIL: You get an error mentioning a Boolean is expected and got a String value.
Comment 1 Tomás Cohen Arazi (tcohen) 2017-01-18 18:27:44 UTC
Adding a TO_JSON method seems a better approach as it won't hide data issues (which could happen if coercing values into booleans).

*** This bug has been marked as a duplicate of bug 17932 ***