Hi Mike,
Please see below.
Jason

From: netmod <[email protected]> On Behalf Of Michael Rehder
Sent: Tuesday, October 9, 2018 1:51 PM
To: [email protected]
Subject: [netmod] WHEN statement within mandatory objects doesn't ensure 
presence of the mandatory object

I have a question about “when” and mandatory objects.

It seems to me that the implemented semantics of “when” are really “optional 
when”, in that the enclosing object can be absent even though it is mandatory 
and the “when” clause holds true.
The RFC could be clearer about this.

Example

   leaf color {
     enumeration  {
        enum “blue”;
        enum “black”;
     }
     mandatory true;
   }
   container foo {
      when ../color = ‘blue’;
      etc.
   }

“foo” is optional due to the presence of the “when” statement even though the 
object is mandatory (same is true for mandatory leaf, min-elements=1 list etc.).
[>>JTS: ]  What do you mean by "the object is mandatory" ?  I see that leaf 
color is mandatory (so it must have a value of either black or blue).  But the 
container foo is not mandatory.

This is considered valid XML for the above
    <color>blue</color>

In my view this makes conditionally variant schemas “loose” in their 
enforcement (some scenarios can use choice but it doesn’t cover everything).

I think that mandatory should be respected for the enclosing objects of a 
“when” statement.
That is, a mandatory object must be present when its “when” clause holds true 
and a Schematron statement should enforce that.
[>>JTS: ] We can't change that definition now. I don't know all the details of 
the rationale but "when" is defined such that its parent data definition 
statement is only valid when the condition in the "when" is true. But that 
doesn't mean that parent node is mandatory. In other words -> a "when" can only 
remove a node (from the schema), it can't enforce that a node exists (in 
instance data).

What is the rationale behind the current YANG rules behavior, that the “when” 
Schematron mapping doesn’t check for presence of the enclosing mandatory object?

thanks
Mike Rehder


“Amdocs’ email platform is based on a third-party, worldwide, cloud-based 
system. Any emails sent to Amdocs will be processed and stored using such 
system and are accessible by third party providers of such system on a limited 
basis. Your sending of emails to Amdocs evidences your consent to the use of 
such system and such processing, storing and access”.
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to