Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-4999

I cannot set a JSON property to null in untyped scripting languages

    Details

    • Type: Bug Report
    • Status: Open
    • Priority: L3 - Default
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: spin
    • Labels:
      None

      Description

      In Javascript (and probably any other untyped scripting language), there is no way to set a JSON property to null using Spin. For example, this fails:

      node = S(input, "application/json");
      node.prop("order", null);
      

      with the error:

      Can't unambiguously select between fixed arity signatures [(java.lang.String, org.camunda.spin.json.SpinJsonNode), (java.lang.String, java.lang.Boolean), (java.lang.String, java.lang.String), (java.lang.String, java.util.Map), (java.lang.String, java.util.List), (java.lang.String, java.lang.Number)] of the method org.camunda.spin.impl.json.jackson.JacksonJsonNode.prop for argument types [java.lang.String, null]
      

      Apparently, some scripting engines have more or less ugly extensions to explicitly select a method. For example, in Nashorn, the problem can be worked around as follows:
      node["prop(String, String)"]("order", null);

        Issue Links

          Activity

          thorben.lindhauer Thorben Lindhauer created issue -
          thorben.lindhauer Thorben Lindhauer made changes -
          Field Original Value New Value
          Link This issue is related to CAM-4479 [ CAM-4479 ]
          thorben.lindhauer Thorben Lindhauer made changes -
          Description In Javascript (and probably any other untyped scripting language), there is no way to set a JSON property to null using Spin. For example, this fails:

          {code}
          node = S(input, "application/json");
          node.prop("order", null);
          {code}

          with the error:
          {code}
          Can't unambiguously select between fixed arity signatures [(java.lang.String, org.camunda.spin.json.SpinJsonNode), (java.lang.String, java.lang.Boolean), (java.lang.String, java.lang.String), (java.lang.String, java.util.Map), (java.lang.String, java.util.List), (java.lang.String, java.lang.Number)] of the method org.camunda.spin.impl.json.jackson.JacksonJsonNode.prop for argument types [java.lang.String, null]
          {code}
          In Javascript (and probably any other untyped scripting language), there is no way to set a JSON property to null using Spin. For example, this fails:

          {code}
          node = S(input, "application/json");
          node.prop("order", null);
          {code}

          with the error:
          {code}
          Can't unambiguously select between fixed arity signatures [(java.lang.String, org.camunda.spin.json.SpinJsonNode), (java.lang.String, java.lang.Boolean), (java.lang.String, java.lang.String), (java.lang.String, java.util.Map), (java.lang.String, java.util.List), (java.lang.String, java.lang.Number)] of the method org.camunda.spin.impl.json.jackson.JacksonJsonNode.prop for argument types [java.lang.String, null]
          {code}

          and there appears to be no Nashorn extension to explicitly select one of them (plus that would not be very convenient/obvious for users).
          thorben.lindhauer Thorben Lindhauer made changes -
          Description In Javascript (and probably any other untyped scripting language), there is no way to set a JSON property to null using Spin. For example, this fails:

          {code}
          node = S(input, "application/json");
          node.prop("order", null);
          {code}

          with the error:
          {code}
          Can't unambiguously select between fixed arity signatures [(java.lang.String, org.camunda.spin.json.SpinJsonNode), (java.lang.String, java.lang.Boolean), (java.lang.String, java.lang.String), (java.lang.String, java.util.Map), (java.lang.String, java.util.List), (java.lang.String, java.lang.Number)] of the method org.camunda.spin.impl.json.jackson.JacksonJsonNode.prop for argument types [java.lang.String, null]
          {code}

          and there appears to be no Nashorn extension to explicitly select one of them (plus that would not be very convenient/obvious for users).
          In Javascript (and probably any other untyped scripting language), there is no way to set a JSON property to null using Spin. For example, this fails:

          {code}
          node = S(input, "application/json");
          node.prop("order", null);
          {code}

          with the error:
          {code}
          Can't unambiguously select between fixed arity signatures [(java.lang.String, org.camunda.spin.json.SpinJsonNode), (java.lang.String, java.lang.Boolean), (java.lang.String, java.lang.String), (java.lang.String, java.util.Map), (java.lang.String, java.util.List), (java.lang.String, java.lang.Number)] of the method org.camunda.spin.impl.json.jackson.JacksonJsonNode.prop for argument types [java.lang.String, null]
          {code}

          Apparently, some scripting engines have more or less ugly extensions to explicitly select a method. For example, in Nashorn, the problem can be worked around as follows:
          {{node["prop(String, String)"]("order", null);}}
          thorben.lindhauer Thorben Lindhauer made changes -
          Workflow camunda BPM [ 31781 ] Backup_camunda BPM [ 55694 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              thorben.lindhauer Thorben Lindhauer
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Development