Hi,

I know that I have been involved in some discussions on this topic in the past, 
but I'm not sure that I ever tracked to conclusion, and it feels like the RFC 
has potentially ended up in a slight strange, and perhaps underspecified place.

Section 6.12 makes it clear that the union encoding in CBOR:

  *
is different from how the regular type is encoded (e.g., enums and bits are 
encoded as strings when within a union)
  *
the reason that this is done is for consistency of parsing with XML (which 
seems like a reasonable reason).

However, it also defines CBOR tags to allow different values encoded as strings 
to be discriminated against (for bits, enum, ident-ref and instance-identifier).

The YANG encoding in JSON RFC (RFC 7951), section 6.10, makes it clear that 
type information is used when validating a value of a union type, which means 
that the JSON parsing of the values of nodes that are data type union already 
potentially differs from XML (e.g., consider the simple case that the first 
union type was an unrestricted string, along with an integer).

The CBOR YANG encoding includes CBOR tags to identify the type but does not 
indicate whether those tags should be used during parsing (e.g., as JSON 
decoding would).  I presume that they should be used, otherwise the tags seem 
to serve no useful purpose.

But if we are using the CBOR type tags to discriminate when validating then it 
isn't clear to me what the benefit is of then using strings for bits and enums 
when parsing union values using those types.

Can anyone clarify what the expected behaviour is when parsing please?  Is an 
erratum needed/helpful here?

Kind regards,
Rob



_______________________________________________
netmod mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to