clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
215 stars 72 forks source link

JSON leaf-list output single element leaf-list does not use array #261

Closed olofhagsand closed 3 years ago

olofhagsand commented 3 years ago

JSON output, such as in RESTCONF, does not properly output JSON for leafrefs for single element lists

Example YANG:

     leaf-list l1{
       type string;
     }

Expected output: {"l1":[1]}

Actual output: {"l1":1}

swh1991 commented 3 years ago

use release version 5.3 , issue persist , different use and result is different.

Example YANG, result is ok.

container test {
    leaf-list number{
        type int32;
   }
}
Expected output:
{"test": {"number": [1]}
Actual output:
{"test": {"number": [1]}

Example YANG, result is error.

leaf-list number{
    type int32;
}
Expected output:
{"number": [1]}
Actual output:
{"number": 1}​