Subject: [YANG] mandatory empty

From: Andy Bierman <[email-masked]>
Date: Mon, 04 Feb 2008 10:17:45 -0800

Hi,

What does this mean exactly?

   leaf foo {
     type empty;
     mandatory true;
   }

Does this translate to:

   <element name='foo' minOccurs='0'/>

The empty data type can be modeled in XSD as an empty complexType:

   <complexType name='empty'/>

Can it be modeled as a simpleType?

   <simpleType name='empty'>
     <restriction base='xs:string'>
       <maxLength value='0'/>
     </restriction>
   </simpleType>

If mandatory means that the manager must supply a value,
then the leaf 'foo' can never be missing.

Even if it means the agent must supply a value,
it still seems strange.  Perhaps more text is needed
about the empty data type.

IMO, 'mandatory' and 'units' are not applicable to built-in type 'empty'.

Andy
_______________________________________________
YANG mailing list
[email-masked]
http://www.ietf.org/mailman/listinfo/yang

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 04 Feb 2008 20:46:56 +0100 (CET)

>    <element name='foo' minOccurs='0'/>

No, b/c the default type in XSD is anyType, which means any xml.  And
if it's mandatory, it should be minOccurs='1' (which is the default).
But it depends on what your XSD is supposed to validate - a NETCONF
PDU or the datastore.

I translate this into:

      <xs:element name="foo">
        <xs:complexType/>
      </xs:element>

>    <complexType name='empty'/>

Yes.

>      <restriction base='xs:string'>

I don't know.  Maybe?

> IMO, 'mandatory' and 'units' are not applicable to built-in type 'empty'.

I agree that units on a type empty seems weird.

mandatory true on type empty also seems weird, since a type empty leaf
provides a single bit of information (in its existance).  So if it
always has to be there, what is the point?

I don't know if we have to make this an error though.

/martin