<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:09:43 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-405] Generated unions fail to enforce patterns</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-405</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;The following snippet, taken from openconfig-bgp-policy.yang:&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 bgp-set-med-type {
&#160;&#160;&#160; type union {
&#160;&#160;&#160;&#160;&#160; type uint32;
&#160;&#160;&#160;&#160;&#160; type string {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pattern &lt;span class=&quot;code-quote&quot;&gt;&quot;^[+-][0-9]+&quot;&lt;/span&gt;;
&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160;&#160;&#160; type enumeration {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;enum&lt;/span&gt; IGP {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; description &quot;set the MED value to the IGP cost toward the
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; next hop &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; the route&quot;;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160; }
&#160;&#160;&#160; description
&#160;&#160;&#160;&#160;&#160; &quot;Type definition &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; specifying how the BGP MED can
&#160;&#160;&#160;&#160;&#160; be set in BGP policy actions. The three choices are to set
&#160;&#160;&#160;&#160;&#160; the MED directly, increment/decrement using +/- notation,
&#160;&#160;&#160;&#160;&#160; and setting it to the IGP cost (predefined value).&quot;;
&#160; }

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;results in the following code:&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; &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; List&amp;lt;&lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt;&amp;gt; PATTERN_CONSTANTS = ImmutableList.of(&lt;span class=&quot;code-quote&quot;&gt;&quot;^(?:\\^[+-][0-9]+)$&quot;&lt;/span&gt;);
&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; Pattern patterns = Pattern.compile(PATTERN_CONSTANTS.get(0));
&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; regexes = &lt;span class=&quot;code-quote&quot;&gt;&quot;^[+-][0-9]+&quot;&lt;/span&gt;;
&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;Long&lt;/span&gt; _uint32;
&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; _string;
&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; Enumeration _enumeration;


&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; void checkUint32Range(&lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;long&lt;/span&gt; value) {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (value &amp;gt;= 0L &amp;amp;&amp;amp; value &amp;lt;= 4294967295L) {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt;;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160;&#160;&#160;&#160;&#160; CodeHelpers.throwInvalidRange(&lt;span class=&quot;code-quote&quot;&gt;&quot;[[0..4294967295]]&quot;&lt;/span&gt;, value);
&#160;&#160;&#160; }
&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; BgpSetMedType(&lt;span class=&quot;code-object&quot;&gt;Long&lt;/span&gt; _uint32) {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;super&lt;/span&gt;();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; checkUint32Range(_uint32);
&#160;&#160;&#160;&#160;&#160;&#160; &#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;._uint32 = _uint32;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;._string = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;._enumeration = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
&#160;&#160;&#160; }
&#160;&#160; &#160;
&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; void check_stringLength(&lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; value) {
&#160;&#160;&#160; }
&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; BgpSetMedType(&lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; _string) {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;super&lt;/span&gt;();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; check_stringLength(_string);
&#160;&#160;&#160;&#160;&#160;&#160; &#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;._string = _string;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;._uint32 = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;._enumeration = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
&#160;&#160;&#160; }

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Note there is a useless check_stringLength() emitted, which is probably fine. What is not fine is that the String enforcement is completely missing, eventhough we have generated the appropriate regexs constant.&lt;/p&gt;</description>
                <environment></environment>
        <key id="31194">MDSAL-405</key>
            <summary>Generated unions fail to enforce patterns</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="3" iconUrl="https://jira.opendaylight.org/images/icons/statuses/inprogress.png" description="This issue is being actively worked on at the moment by the assignee.">In Progress</status>
                    <statusCategory id="4" key="indeterminate" colorName="yellow"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="ivanhrasko">Ivan Hrasko</assignee>
                                    <reporter username="rovarga">Robert Varga</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Fri, 14 Dec 2018 04:50:26 +0000</created>
                <updated>Thu, 25 Jan 2024 11:16:33 +0000</updated>
                                            <version>3.0.2</version>
                                    <fixVersion>14.0.0</fixVersion>
                                    <component>Binding codegen</component>
                        <due></due>
                            <votes>1</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="66016" author="rovarga" created="Fri, 14 Dec 2018 15:36:18 +0000"  >&lt;p&gt;PATTERN_CONSTANTS needs to remain publicly-visible, though deprecated. We need to define a&#160; new per-leaf constant schema, which will mimic what is being done, albeit in private. Furthermore PATTERN_CONSTANTS should not be compiled into enforcement patters.&lt;/p&gt;</comment>
                            <comment id="69002" author="rovarga" created="Tue, 16 Feb 2021 16:34:22 +0000"  >&lt;p&gt;This and related issues may be resolved as part of adoption of yangtools-7. We&apos;ll see when that effort is complete.&lt;/p&gt;</comment>
                            <comment id="73108" author="rovarga" created="Thu, 18 Jan 2024 16:43:08 +0000"  >&lt;p&gt;So this really needs to be addressed in one go with &lt;a href=&quot;https://jira.opendaylight.org/browse/MDSAL-361&quot; title=&quot;Deal with restricted types in unions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MDSAL-361&quot;&gt;MDSAL-361&lt;/a&gt; &amp;#8211; there are just too many open cases we need to cover. See mdsal405.yang for detailed use cases.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                            <outwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="30285">MDSAL-361</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="32262">MDSAL-502</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="32263">MDSAL-503</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|i03lgv:</customfieldvalue>

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