Uploaded image for project: 'Fluid Infusion'
  1. Fluid Infusion
  2. FLUID-5251

conditional expander causes both options to be evaluated causing problems with the current output model

    XMLWordPrintable

Details

    Description

      Our latest output model that says "each transformer EITHER outputs immediately to the document at its current path, OR it makes a return value" has introduced a bug in the conditional expander. The issue is that, the way the transformer is implemented both conditions are evaluated (with ofc. only one returned). This wasn't a problem with our old output model, as only the returned values was output. But with our current model, if the 'true' and/or 'false' blocks contain a statements that outputs to the document, it will ALWAYS be output.. In other words, any output requested in either of the true/false will always be output - disregarding whether the condition evaluates to that case. An example below to illustrate:

      model:

      { con: true, a: "are furry", b: "are barky" }

      rule: {
      "wisdom": {
      "transform": {
      "type": "fluid.transforms.condition",
      "conditionPath": "con",
      "true":

      { "cats": "a", }

      ,
      "false":

      { "dogs": "b", }

      }
      }
      }

      would give the result:

      "wisdom":

      { "cats": "are furry", "dogs": "are barky" }

      and while both might be wise statements, we would have expected only to see:

      "wisdom":

      { "cats": "are furry" }

      Whereas we would expect:

      "wisdom":

      { "all": "cats" }

      The fix for this JIRA would be to ensure only the correct block gets evaluated

      Attachments

        Activity

          People

            colin Colin Clark
            kaspermarkus Kasper Galschiot Markus
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: