<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:16:44 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[NETCONF-1123] Union type does not work for number and boolean format</title>
                <link>https://jira.opendaylight.org/browse/NETCONF-1123</link>
                <project id="10142" key="NETCONF">netconf</project>
                    <description>&lt;p&gt;Steps to reproduce:&lt;/p&gt;

&lt;p&gt;1. on netconf master branch, add this model into &lt;b&gt;restconf/restconf-openapi/src/test/resources/yang/&lt;/b&gt; and name it &lt;b&gt;definition-test.yang&lt;/b&gt;&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
module definition-test {
  namespace &lt;span class=&quot;code-quote&quot;&gt;&quot;urn:definition-test&quot;&lt;/span&gt;;
  prefix sample;

  typedef topology-ref {
    type instance-identifier;
  }

  container binary-container {
    leaf binary-data {
      type binary;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;SGVsbG8gdGVzdCE=&quot;&lt;/span&gt;;
    }
  }

  container union-container {
    leaf testUnion1 {
      type union {
        type int32;
        type string;
      }
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; 5;
    }

    leaf testUnion2 {
      type union {
        type string;
        type &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt;;
      }
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
    }

    leaf testUnion3 {
      type union {
        type int32;
        type &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt;;
      }
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
    }

    leaf testBoolean {
      type &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt;;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
    }
  }

  container number-container {
    leaf testInteger {
      type int32;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; 42;
    }

    leaf testUnsignedInteger {
      type uint16;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; 100;
    }

    leaf testDecimal {
      type decimal64 {
        fraction-digits 2;
      }
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; 3.14;
    }

    leaf testDouble {
      type decimal64 {
        fraction-digits 11;
      }
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; 3.14159265359;
    }

    leaf testInt64 {
      type int64;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; 42;
    }

    leaf testUint64 {
      type uint64;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; 42;
    }
  }

  container &lt;span class=&quot;code-keyword&quot;&gt;enum&lt;/span&gt;-container {
    leaf status {
      type enumeration {
        &lt;span class=&quot;code-keyword&quot;&gt;enum&lt;/span&gt; up {
          value 1;
        }
        &lt;span class=&quot;code-keyword&quot;&gt;enum&lt;/span&gt; down {
          value 2;
        }
      }
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;up&quot;&lt;/span&gt;;
    }
  }

  container network-container {
    leaf network-ref {
      type topology-ref;
      &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;/network/nodes[node-id=&lt;span class=&quot;code-quote&quot;&gt;&apos;node1&apos;&lt;/span&gt;]&quot;&lt;/span&gt;;
    }
  }
}
 &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;2.&lt;br/&gt;
Add this test into DefinitionGeneratorTest.java&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
@Test
&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; void testUnionTypes() &lt;span class=&quot;code-keyword&quot;&gt;throws&lt;/span&gt; IOException {
    &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; module = context.findModule(&lt;span class=&quot;code-quote&quot;&gt;&quot;definition-test&quot;&lt;/span&gt;).orElseThrow();
    &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; generator = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; DefinitionGenerator();
    &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; jsonObject = generator.convertToSchemas(module, context, &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; DefinitionNames(), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
    assertNotNull(jsonObject);

    &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; properties = jsonObject.get(&lt;span class=&quot;code-quote&quot;&gt;&quot;definition-test_config_union-container&quot;&lt;/span&gt;).properties();
    assertEquals(&lt;span class=&quot;code-quote&quot;&gt;&quot;5&quot;&lt;/span&gt;, properties.get(&lt;span class=&quot;code-quote&quot;&gt;&quot;testUnion1&quot;&lt;/span&gt;).get(&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;&quot;&lt;/span&gt;).asText());
    assertEquals(&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;, properties.get(&lt;span class=&quot;code-quote&quot;&gt;&quot;testUnion1&quot;&lt;/span&gt;).get(&lt;span class=&quot;code-quote&quot;&gt;&quot;type&quot;&lt;/span&gt;).asText());
    assertEquals(&lt;span class=&quot;code-quote&quot;&gt;&quot;Some testUnion1&quot;&lt;/span&gt;, properties.get(&lt;span class=&quot;code-quote&quot;&gt;&quot;testUnion1&quot;&lt;/span&gt;).get(&lt;span class=&quot;code-quote&quot;&gt;&quot;example&quot;&lt;/span&gt;).asText());
    assertEquals(&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;&quot;&lt;/span&gt;, properties.get(&lt;span class=&quot;code-quote&quot;&gt;&quot;testUnion2&quot;&lt;/span&gt;).get(&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;&quot;&lt;/span&gt;).asText());
    assertEquals(&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;, properties.get(&lt;span class=&quot;code-quote&quot;&gt;&quot;testUnion2&quot;&lt;/span&gt;).get(&lt;span class=&quot;code-quote&quot;&gt;&quot;type&quot;&lt;/span&gt;).asText());
    assertEquals(&lt;span class=&quot;code-quote&quot;&gt;&quot;Some testUnion2&quot;&lt;/span&gt;, properties.get(&lt;span class=&quot;code-quote&quot;&gt;&quot;testUnion2&quot;&lt;/span&gt;).get(&lt;span class=&quot;code-quote&quot;&gt;&quot;example&quot;&lt;/span&gt;).asText());
    assertEquals(&lt;span class=&quot;code-quote&quot;&gt;&quot;number&quot;&lt;/span&gt;, properties.get(&lt;span class=&quot;code-quote&quot;&gt;&quot;testUnion3&quot;&lt;/span&gt;).get(&lt;span class=&quot;code-quote&quot;&gt;&quot;type&quot;&lt;/span&gt;).asText());
    assertEquals(&lt;span class=&quot;code-quote&quot;&gt;&quot;0&quot;&lt;/span&gt;, properties.get(&lt;span class=&quot;code-quote&quot;&gt;&quot;testUnion3&quot;&lt;/span&gt;).get(&lt;span class=&quot;code-quote&quot;&gt;&quot;example&quot;&lt;/span&gt;).asText());
    assertEquals(&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;&quot;&lt;/span&gt;, properties.get(&lt;span class=&quot;code-quote&quot;&gt;&quot;testUnion3&quot;&lt;/span&gt;).get(&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;&quot;&lt;/span&gt;).asText());
}
 &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Run the test. This will cause an exception to be thrown inside:&lt;br/&gt;
&lt;a href=&quot;https://git.opendaylight.org/gerrit/c/netconf/+/105875/24/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/DefinitionGenerator.java#876&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/c/netconf/+/105875/24/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/DefinitionGenerator.java#876&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The exception:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
java.lang.NumberFormatException: For input string: &lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;&quot;&lt;/span&gt;
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)	at java.base/java.lang.&lt;span class=&quot;code-object&quot;&gt;Long&lt;/span&gt;.parseLong(&lt;span class=&quot;code-object&quot;&gt;Long&lt;/span&gt;.java:711)	at java.base/java.lang.&lt;span class=&quot;code-object&quot;&gt;Long&lt;/span&gt;.valueOf(&lt;span class=&quot;code-object&quot;&gt;Long&lt;/span&gt;.java:1159)	at org.opendaylight.restconf.openapi.impl.DefinitionGenerator.lambda$processUnionType$17(DefinitionGenerator.java:889)	at java.base/java.util.Optional.ifPresent(Optional.java:178)	at org.opendaylight.restconf.openapi.impl.DefinitionGenerator.processUnionType(DefinitionGenerator.java:889)	at org.opendaylight.restconf.openapi.impl.DefinitionGenerator.processTypeDef(DefinitionGenerator.java:625)	at org.opendaylight.restconf.openapi.impl.DefinitionGenerator.processLeafNode(DefinitionGenerator.java:564)	at org.opendaylight.restconf.openapi.impl.DefinitionGenerator.processChildNode(DefinitionGenerator.java:492)	at org.opendaylight.restconf.openapi.impl.DefinitionGenerator.processChildren(DefinitionGenerator.java:442)	at org.opendaylight.restconf.openapi.impl.DefinitionGenerator.processDataNodeContainer(DefinitionGenerator.java:403)	at org.opendaylight.restconf.openapi.impl.DefinitionGenerator.processContainersAndLists(DefinitionGenerator.java:263)	at org.opendaylight.restconf.openapi.impl.DefinitionGenerator.convertToSchemas(DefinitionGenerator.java:150)	at org.opendaylight.restconf.openapi.impl.DefinitionGenerator.convertToSchemas(DefinitionGenerator.java:167) &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;And the place inside yang model which causes this is here:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
leaf testUnion3 {
  type union {
    type int32;
    type &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt;;
  }
  &lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
} &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="37182">NETCONF-1123</key>
            <summary>Union type does not work for number and boolean format</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.opendaylight.org/images/icons/priorities/major.svg">Medium</priority>
                        <status id="5" iconUrl="https://jira.opendaylight.org/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10001">Won&apos;t Do</resolution>
                                        <assignee username="ivanhrasko">Ivan Hrasko</assignee>
                                    <reporter username="tobias.pobocik">Tobias Pobocik</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Tue, 8 Aug 2023 08:44:14 +0000</created>
                <updated>Tue, 15 Aug 2023 10:22:34 +0000</updated>
                            <resolved>Tue, 15 Aug 2023 10:22:34 +0000</resolved>
                                                                    <component>restconf-openapi</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="72445" author="ivanhrasko" created="Tue, 15 Aug 2023 10:22:34 +0000"  >&lt;p&gt;The logic will be completely removed/reworked in &lt;a href=&quot;https://jira.opendaylight.org/browse/NETCONF-1124&quot; title=&quot;OpenApi: Improve union type processing&quot; class=&quot;issue-link&quot; data-issue-key=&quot;NETCONF-1124&quot;&gt;&lt;del&gt;NETCONF-1124&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i0466n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>