<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:54:25 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>[YANGTOOLS-824] A non-presence container has at least one mandatory child node shoud be set mandatory true ?</title>
                <link>https://jira.opendaylight.org/browse/YANGTOOLS-824</link>
                <project id="10188" key="YANGTOOLS">yangtools</project>
                    <description>&lt;p&gt;According to RFC rules:&lt;br/&gt;
 A mandatory node is one of:&lt;br/&gt;
...&lt;br/&gt;
&quot;A container node without a &quot;presence&quot; statement and that has at&lt;br/&gt;
least one mandatory node as a child.&quot;&lt;/p&gt;

&lt;p&gt;Currently , it is false,  IMO all ancestor nodes of a mandatory node should set mandatory   to be true as default.&lt;/p&gt;</description>
                <environment></environment>
        <key id="28648">YANGTOOLS-824</key>
            <summary>A non-presence container has at least one mandatory child node shoud be set mandatory true ?</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="10000">Done</resolution>
                                        <assignee username="rovarga">Robert Varga</assignee>
                                    <reporter username="JieHan2017">Jie Han</reporter>
                        <labels>
                    </labels>
                <created>Tue, 31 Oct 2017 09:09:01 +0000</created>
                <updated>Tue, 26 Dec 2017 09:20:57 +0000</updated>
                            <resolved>Tue, 26 Dec 2017 09:20:57 +0000</resolved>
                                    <version>2.0.0</version>
                                    <fixVersion>2.0.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="59856" author="rovarga" created="Tue, 31 Oct 2017 09:38:26 +0000"  >&lt;p&gt;This really is a question on what isMandatory() reflects. Historically it reflected the presence of a mandatory statement, e.g. the declared model of the world.&lt;/p&gt;

&lt;p&gt;Making it reflect the reality of effective world is problematic, as it is not a static property, consider e.g.:&lt;/p&gt;

&lt;p&gt;grouping grp {&lt;br/&gt;
    leaf foo &lt;/p&gt;
{
        type string;
        mandatory true;
    }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;leaf bar &lt;/p&gt;
{
    type string;
}

&lt;p&gt;container baz {&lt;br/&gt;
    uses grp &lt;/p&gt;
{
        when ../bar;
    }
&lt;p&gt;}&lt;/p&gt;</comment>
                            <comment id="59857" author="jiehan2017" created="Tue, 31 Oct 2017 11:00:53 +0000"  >&lt;p&gt;Yep, anyway, when &quot;mandatory&quot; meets &quot;when&quot;, it&apos;s not clear and confusing what mandatory does reflect.&lt;br/&gt;
In RFC it said  &quot;If a key leaf is defined in a grouping that is used in a list, the&quot;uses&quot; statement MUST NOT have a &quot;when&quot; statement.&quot;&lt;br/&gt;
and that may be suitable for a mandatory node just like &lt;br/&gt;
&quot;If a mandatory node is defined in a grouping, the&quot;uses&quot; statement MUST NOT have a &quot;when&quot; statement.&quot;&lt;/p&gt;</comment>
                            <comment id="59860" author="rovarga" created="Tue, 31 Oct 2017 13:10:21 +0000"  >&lt;p&gt;Ah, I see, I missed those bits.&lt;/p&gt;

&lt;p&gt;Incidentally I came across isMandatory() just yesterday during the push to cleanup yang-model-api and it still is on my plate.&lt;/p&gt;

&lt;p&gt;In the end, I think isMandatory() should reflect whether or not a node is effectively mandatory, if it can be proven to be static property and if we can get users working (yang-model-export may need a major update to work completely on the declared model anyway, but there may be others0.&lt;/p&gt;</comment>
                            <comment id="59861" author="rovarga" created="Tue, 31 Oct 2017 13:40:25 +0000"  >&lt;p&gt;Actually that will not completely work, either. Even if we expand the scope of that uses restriction to cover mandatory nodes, it does not solve augmentations, which may explicitly add mandatory nodes &lt;b&gt;only&lt;/b&gt; when guarded by a when conditions:&lt;/p&gt;

&lt;p&gt;module foo:&lt;br/&gt;
container foo { }&lt;/p&gt;

&lt;p&gt;module bar:&lt;br/&gt;
import foo &lt;/p&gt;
{ prefix foo }
&lt;p&gt;;&lt;br/&gt;
leaf bar &lt;/p&gt;
{ type string; }

&lt;p&gt;augment /foo:foo {&lt;br/&gt;
    leaf baz &lt;/p&gt;
{ type string; mandatory true; }
&lt;p&gt;    when &quot;../bar&quot;;&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;This case is specifically called out in RFC7950, hence isMandatory() cannot be made a static property, because the intepretation of augment applicability (and hence the decision whether /foo is mandatory) depends on the data being processed.&lt;/p&gt;

&lt;p&gt;I will add a comment to this effect.&lt;/p&gt;</comment>
                            <comment id="59871" author="jiehan2017" created="Wed, 1 Nov 2017 01:36:26 +0000"  >&lt;p&gt; I also found this in RFC7950 (Section 8.1):&lt;br/&gt;
&quot;The &quot;mandatory&quot; constraint is enforced for leafs and choices,&lt;br/&gt;
unless the node or any of its ancestors has a &quot;when&quot; condition or&lt;br/&gt;
&quot;if-feature&quot; expression that evaluates to &quot;false&quot;.&quot;&lt;br/&gt;
So maybe we could just divide it into two parts:&lt;br/&gt;
1) DO NOT has a &quot;when&quot; condition &lt;br/&gt;
   All ancestors(here non-presence container specifed explicitly, not grouping or others) of a mandatory node should be made a static property;&lt;br/&gt;
2) Has a &quot;when&quot; condition &lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Uses with a &quot;when&quot; condition, all ancestors of uses node would not be made the static property;&lt;/li&gt;
	&lt;li&gt;Augment with a &quot;when&quot; condition, all ancestors of target node  would not be made the static property;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="59872" author="jiehan2017" created="Wed, 1 Nov 2017 01:51:29 +0000"  >&lt;p&gt;In RFC7950 (Section 7.17):&lt;br/&gt;
&quot;If the augmentation adds mandatory nodes (see Section 3) that&lt;br/&gt;
represent configuration to a target node in another module, the&lt;br/&gt;
augmentation MUST be made conditional with a &quot;when&quot; statement. &quot;&lt;/p&gt;</comment>
                            <comment id="59899" author="rovarga" created="Fri, 3 Nov 2017 12:12:44 +0000"  >&lt;p&gt;Well, I guess the primary question is what use case do we have for such a flag. isMandatory() certainly is going away from ConstraintDefinition (as that entire interface needs to go), hence isMandatory() will not be emitted for containers at all (only leaf/choice/anydata/anyxml will have it).&lt;/p&gt;</comment>
                            <comment id="60558" author="rovarga" created="Tue, 26 Dec 2017 09:20:57 +0000"  >&lt;p&gt;Since ConstraintDefinition has been eliminated, isMandatory() reflects the value of &apos;mandatory&apos; statement only, making the definition consistent.&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|i036yv:</customfieldvalue>

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