Hello,
it seems that there are cases when YANG data represented in JSON include more 
information than when converted to XML. Example:

YANG:

module a {
  leaf l {
    type union {
      type string;
      type uint8;
    }
  }
}

JSON:

{
  "a:l": 20
}

These data will be parsed as the leaf "l" of type "uint8" based on the JSON 
specs [1]. Then, when printed again

XML:

<a:l>20<a:l>

this XML would be parsed as leaf "l" of type "string".

Similar problem occurs also for boolean. So I am just wondering, is this a 
known bug/feature, is it intentional? It is true that applications usually 
choose one format and stick to it but it is not a requirement and I can see 
this having possibly quite nasty consequences.

Regards,
Michal

[1] https://tools.ietf.org/html/rfc7951#section-6.10

_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to