Bug 17926

Summary: REST API: Boolean values should be coerced
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: Web servicesAssignee: Tomás Cohen Arazi <tomascohen>
Status: RESOLVED DUPLICATE QA Contact: Martin Renvoize <martin.renvoize>
Severity: normal    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description Tomás Cohen Arazi 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 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 ***