goldmansachs/jdmn

unable to transform single decision table

Closed this issue · 3 comments

Expected Behavior

Expected to translate a decision table into a Java object.

Actual Behavior

The maven plugin errored with Name and variable cannot be null. Found 'Test Table' and 'null'

jDMN Version where this issue was observed

<groupId>com.goldmansachs.jdmn</groupId>
<artifactId>jdmn-maven-plugin</artifactId>
<version>8.2.1</version>

Steps to reproduce the behavior

Used the Camunda Modeler to create a DMN v8 table

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_02tdzst" name="DRD" namespace="http://camunda.org/schema/1.0/dmn">
  <decision id="Decision_1ox66vb" name="Test Table">
    <decisionTable id="DecisionTable_1b0rptv" hitPolicy="FIRST">
      <input id="Input_1" label="input number">
        <inputExpression id="InputExpression_1" typeRef="number">
          <text>n</text>
        </inputExpression>
      </input>
      <output id="Output_1" label="describe" name="output" typeRef="string" />
      <rule id="DecisionRule_1xms2ep">
        <inputEntry id="UnaryTests_0k9ck88">
          <text>&gt;= 1</text>
        </inputEntry>
        <outputEntry id="LiteralExpression_0yra77b">
          <text>"at least 1"</text>
        </outputEntry>
      </rule>
      <rule id="DecisionRule_0t51c5e">
        <inputEntry id="UnaryTests_1blk8bh">
          <text>&lt; 1</text>
        </inputEntry>
        <outputEntry id="LiteralExpression_0opa3o7">
          <text>"lt 1"</text>
        </outputEntry>
      </rule>
    </decisionTable>
  </decision>
  <dmndi:DMNDI>
    <dmndi:DMNDiagram>
      <dmndi:DMNShape dmnElementRef="Decision_1ox66vb">
        <dc:Bounds height="80" width="180" x="160" y="100" />
      </dmndi:DMNShape>
    </dmndi:DMNDiagram>
  </dmndi:DMNDI>
</definitions>

Specifically, the variable field on the TDecision object is never set

The variable field is a mandatory field and it should be populated. Please have a look at a few test cases in the TCK project https://github.com/dmn-tck/tck/tree/master/TestCases

Sorry for the obvious issue, I was caught off guard by the lack of tck compliance in my editor.

For the sake of using our existing toolset, would this be a good use case for a custom DMNTransformer to add the missing variable node? In my case, the name of the table is the variable name.

We need the typeRef as well, this cannot be inferred all the time, e.g. for input data.