Hi,

Jack Rickard <jack.rickard=40microsoft....@dmarc.ietf.org> writes:

> Hi,
>
> I think I've found an ambiguity in RFC 7951, and I'd like your input on what 
> was intended and what the best behaviour to exhibit is.
>
> Section 5.3 and 5.4 of RFC 7951 - JSON Encoding of Data Modeled with YANG 
> (ietf.org)<https://datatracker.ietf.org/doc/html/rfc7951#section-5.3> 
> describe the encoding of leaf-lists and lists, however it's unclear how an 
> empty list should be encoded. Should it be encoded as:
>
>   1.  An empty array: {"list": []}
>   2.  A missing field: {}

Both variants are equivalent and should be supported by tools and libraries.

I can understand though that tools supporting both XML and JSON representations 
tend to prefer #2 because #1 doesn't exist in XML.

Also note that #1 isn't really of much use, as entire list and leaf-list 
instances aren't even resources/endpoints in RESTCONF API - e.g. it's not 
possible to GET the entire list.

Lada

>
> I've seen libraries go either way, libyang only accepts 2 but the python 
> yangson library accepts both (I'm not sure which is the default).
>
> Thanks,
> Jack Rickard
> he/him
> Software Engineer
> jack.rick...@microsoft.com<mailto:jack.rick...@microsoft.com>
>
> [Microsoft Logo]
>
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod

-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67

_______________________________________________
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to