<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:09:37 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>[MDSAL-361] Deal with restricted types in unions</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-361</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;A typical example of a union which we do not handle correctly is:&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;
&#160;&#160;&#160; typedef pce-id {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; type union {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; type binary {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; length 4;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; type binary {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; length 16;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160; }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;These types are restricted and guaranteed not to overlap, but our current codegen rules silently squash them to a single field (first one wins, I think).&lt;/p&gt;

&lt;p&gt;There are multiple approaches we could take, like squashing the definitions, but that would only serve to confuse users &#8211; in this particular case they would be better served by generating encapsulated types for member &#8211; i.e. similar to what we do for enumerations.&lt;/p&gt;

&lt;p&gt;We need to figure out the naming here &#8211; as we cannot just take the &apos;binary&apos; string &#8211; that would result in conflicting names. That naming clash needs to be figured out also for something like:&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;
&#160;&#160;&#160; typedef pce-id {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; type union {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; type enumeration {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;enum&lt;/span&gt; a;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; type enumeration {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;enum&lt;/span&gt; b;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160; }&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="30285">MDSAL-361</key>
            <summary>Deal with restricted types in unions</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="10003" iconUrl="https://jira.opendaylight.org/images/icons/status_generic.gif" description="">Confirmed</status>
                    <statusCategory id="2" key="new" colorName="blue-gray"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="rovarga">Robert Varga</reporter>
                        <labels>
                    </labels>
                <created>Wed, 4 Jul 2018 18:55:38 +0000</created>
                <updated>Thu, 18 Jan 2024 16:44:01 +0000</updated>
                                                            <fixVersion>14.0.0</fixVersion>
                                    <component>Binding codegen</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="65208" author="rovarga" created="Thu, 4 Oct 2018 14:04:01 +0000"  >&lt;p&gt;&lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/76057/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/76057/&lt;/a&gt; needed to be reverted, as it just breaks with:&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;
&#160; typedef route-distinguisher {
&#160;&#160;&#160; type union {
&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-comment&quot;&gt;// type 0: &amp;lt;2-&lt;span class=&quot;code-object&quot;&gt;byte&lt;/span&gt; administrator&amp;gt;:&amp;lt;4-&lt;span class=&quot;code-object&quot;&gt;byte&lt;/span&gt; assigned number&amp;gt;
&lt;/span&gt;&#160;&#160;&#160;&#160;&#160; type string {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pattern &lt;span class=&quot;code-quote&quot;&gt;&quot;(65[0-5][0-3][0-5]|[1-5][1-5][0-9][0-9][0-9]|&quot;&lt;/span&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &lt;span class=&quot;code-quote&quot;&gt;&quot;[1-9]?[1-9]?[0-9][0-9]|[1-9]):&quot;&lt;/span&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &lt;span class=&quot;code-quote&quot;&gt;&quot;(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-5]|&quot;&lt;/span&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &lt;span class=&quot;code-quote&quot;&gt;&quot;[0-3][0-9]{9}|[1-9][0-9]{1,8}|[1-9])&quot;&lt;/span&gt;;
&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-comment&quot;&gt;// type 1: &amp;lt;ip-address&amp;gt;:&amp;lt;2-&lt;span class=&quot;code-object&quot;&gt;byte&lt;/span&gt; assigned number&amp;gt;
&lt;/span&gt;&#160;&#160;&#160;&#160;&#160; type string {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pattern
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}&quot;&lt;/span&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; +&#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]):&quot;&lt;/span&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; +&#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;(65[0-5][0-3][0-5]|[1-5][1-5][0-9][0-9][0-9]|&quot;&lt;/span&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; +&#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;[1-9]?[1-9]?[0-9][0-9]|[1-9])&quot;&lt;/span&gt;;
&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-comment&quot;&gt;// type 2: &amp;lt;4-&lt;span class=&quot;code-object&quot;&gt;byte&lt;/span&gt; as-number&amp;gt;:&amp;lt;2-&lt;span class=&quot;code-object&quot;&gt;byte&lt;/span&gt; assigned number&amp;gt;
&lt;/span&gt;&#160;&#160;&#160;&#160;&#160; type string {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pattern
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-5]|&quot;&lt;/span&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &lt;span class=&quot;code-quote&quot;&gt;&quot;[0-3][0-9]{9}|[1-9][0-9]{1,8}|[1-9]):&quot;&lt;/span&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &lt;span class=&quot;code-quote&quot;&gt;&quot;65[0-5][0-3][0-5]|[1-5]{2}[0-9]{3}|&quot;&lt;/span&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &lt;span class=&quot;code-quote&quot;&gt;&quot;[1-9]{0,2}[0-9][0-9]|[1-9])&quot;&lt;/span&gt;;
&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160; }
&#160;&#160;&#160; description &lt;span class=&quot;code-quote&quot;&gt;&quot;A route distinguisher value&quot;&lt;/span&gt;;
&#160;&#160;&#160; reference &lt;span class=&quot;code-quote&quot;&gt;&quot;RFC4364&quot;&lt;/span&gt;;
&#160; }

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This effectively means we cannot just squash these types to String and enforce them, but need to generate a proper (nested) class which will represent them. This is not 3.0.0 material, punting to next release.&lt;/p&gt;</comment>
                            <comment id="67571" author="rovarga" created="Tue, 17 Dec 2019 18:58:20 +0000"  >&lt;p&gt;This has been seen in the wild, hence reclassifying as a bug. We will need to address this in a minimally-breaking way, so that the mechanics here kicks in only in the case of a conflict.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10002">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="32260">MDSAL-501</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="31194">MDSAL-405</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="29578">MDSAL-330</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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|i03ghr:</customfieldvalue>

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