<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:08:35 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-74] null check for mandatory fields</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-74</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;It would be nice to add null check to generated java DTO for attributes which represents elements with &quot;mandatory true&quot; in yang.&lt;/p&gt;

&lt;p&gt;Preconditions.checkNotNull could be added in a constructor of java DTO implementation.&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="26896">MDSAL-74</key>
            <summary>null check for mandatory fields</summary>
                <type id="10100" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10310&amp;avatarType=issuetype">Improvement</type>
                                                <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="msunal@cisco.com">Martin Sunal</reporter>
                        <labels>
                    </labels>
                <created>Fri, 6 Mar 2015 16:05:25 +0000</created>
                <updated>Sat, 16 Mar 2019 16:12:38 +0000</updated>
                                                                            <component>Binding codegen</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="54090" author="rashmi.tomer@tcs.com" created="Tue, 1 Dec 2015 11:22:29 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;Since the bug is, to check for null, particularly for the presence of mandate statement with true value, in generated java DTO, we can narrow the change to, leaf element only.&lt;/p&gt;

&lt;p&gt;Note: However as per RFC definition &quot;A mandatory node is one of-&lt;br/&gt;
   o  A leaf, choice, or anyxml node with a &quot;mandatory&quot; statement with&lt;br/&gt;
      the value &quot;true&quot;.&lt;br/&gt;
   o  A list or leaf-list node with a &quot;min-elements&quot; statement with a&lt;br/&gt;
      value greater than zero.&lt;br/&gt;
   o  A container node without a &quot;presence&quot; statement, which has at&lt;br/&gt;
      least one mandatory node as a child.&quot;&lt;br/&gt;
We can raise new bug for the other two.&lt;/p&gt;

&lt;p&gt;So, for this bug the expected location of change, as per my understanding and analysis, should be in one of the constructors of class LeafSchemaNodeBuilder.java (yang-parser-impl module).&lt;/p&gt;

&lt;p&gt;Please correct me if I am wrong on this.Thereby the change look something like following :&lt;/p&gt;

&lt;p&gt;public LeafSchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path,&lt;br/&gt;
            final LeafSchemaNode base) {&lt;br/&gt;
       ...&lt;br/&gt;
        if ((base instanceof LeafSchemaNode) &amp;amp;&amp;amp; constraints.isMandatory()) &lt;/p&gt;
{
            this.type = Preconditions.checkNotNull(base.getType(),
                    &quot;Type must not be null, since mandate statement is true&quot;);
        }
&lt;p&gt; else &lt;/p&gt;
{
            this.type = base.getType();
        }
&lt;p&gt;       ...&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;Please give me a go ahead on above so that I can proceed with checkin of same.&lt;/p&gt;

&lt;p&gt;Rashmi&lt;/p&gt;</comment>
                            <comment id="54091" author="rovarga" created="Tue, 1 Dec 2015 11:49:38 +0000"  >&lt;p&gt;Right, the check should be done for either leaves, as well well any structural container children which are between the current object and a mandatory leaf.&lt;/p&gt;

&lt;p&gt;The change should not be made to LeafSchemaNodeBuilder (or any yangtools component), but rather the code generator templates.&lt;/p&gt;

&lt;p&gt;Furthermore I do not think this is feasible with the current binding specification, because the generated objects are shared between groupings and their instantiations. Each instantiation can specialize the mandatory flag (as well as constraints). This means that the class itself does not know the details of what really is mandatory and what not. Consider the these two cases:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;refine which makes a leaf mandatory&lt;br/&gt;
grouping foo {&lt;br/&gt;
    leaf foo 
{
        type string;
    }
&lt;p&gt;}&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;container bar {&lt;br/&gt;
    uses foo {&lt;br/&gt;
        refine foo &lt;/p&gt;
{
            mandatory true;
        }
&lt;p&gt;    }&lt;br/&gt;
}&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;refine which makes a leaf non-mandatory&lt;br/&gt;
grouping foo {&lt;br/&gt;
    leaf foo 
{
        type string;
        mandatory true;
    }
&lt;p&gt;}&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;container bar {&lt;br/&gt;
    uses foo {&lt;br/&gt;
        refine foo &lt;/p&gt;
{
            mandatory false;
        }
&lt;p&gt;    }&lt;br/&gt;
}&lt;/p&gt;</comment>
                            <comment id="54092" author="rovarga" created="Tue, 21 Jun 2016 22:01:41 +0000"  >&lt;p&gt;No assignee -&amp;gt; Confirmed. Also depends on binding spec 2, as not in comment.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10000">
                    <name>Blocks</name>
                                                                <inwardlinks description="is blocked by">
                                        <issuelink>
            <issuekey id="27059">MDSAL-237</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10002">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="26947">MDSAL-125</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="22835">YANGTOOLS-415</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_10208" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>External issue ID</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2797</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10201" key="com.atlassian.jira.plugin.system.customfieldtypes:url">
                        <customfieldname>External issue URL</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[https://bugs.opendaylight.org/show_bug.cgi?id=2797]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10206" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Issue Type</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10305"><![CDATA[Improvement]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10204" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>ODL SR Target Milestone</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10321"><![CDATA[Carbon]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i02w5j:</customfieldvalue>

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