FLUID-5472: The inversion of fluid.transforms.valueMapper inverts true/false to strings rather than booleans

Metadata

Source
FLUID-5472
Type
Bug
Priority
Major
Status
Closed
Resolution
Not A Bug
Assignee
Antranig Basman
Reporter
Cindy Li
Created
2014-07-15T12:52:23.911-0400
Updated
2014-10-23T13:39:55.375-0400
Versions
  1. 1.5
Fixed Versions
N/A
Component
  1. Model Transformation System

Description

When a model with boolean values is tranformed and inverted back, boolean values are inverted to strings such as "true" or "false", rather than booleans. For example,

The expected model:
{
audio: true
}

The actual inverted model:
{
audio: "true"
};

Comments

  • Cindy Li commented 2014-07-15T12:58:21.808-0400

    Submitted a pull request to demonstrate this issue: https://github.com/fluid-project/infusion/pull/545

  • Antranig Basman commented 2014-07-20T18:49:53.483-0400

    Hi cindyli - this test case isn't valid, since when using the "short form" syntax for the valueMapper, it is assumed that the key values accepted as input are strings - as they always are in JSON structures. The framework will not automatically coerce the strings to other values since it could never expect that the string value wasn't intended. To use non-string values as input values, you need to use the long form of configuration which accepts an array of options, with the input values specified as "inputValue" - in your case

    transform: {
    type: "fluid.transforms.valueMapper",
    inputPath: "audio",
    options: [ {
    "inputValue": true,
    "outputPath": "audio",
    "outputValue": "available"
    },
    {
    "inputValue": false,
    "outputPath": "audio",
    "outputValue": "unavailable"
    }]
    }

    I've issued an updated pull request at https://github.com/fluid-project/infusion/pull/550

  • Cindy Li commented 2014-10-23T13:39:51.942-0400

    The pull request has been merged into the project repo @ d92b850ec325f432eea838849926a3107e3fe7d4