mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
530 stars 342 forks source link

json2xml + type decimal64 #818

Open rawat-he opened 2 years ago

rawat-he commented 2 years ago

Hi,

I have yang model with below definition

leaf interval {
    description
        "the maximum time in seconds";
    type decimal64 {
        fraction-digits 1;
        range "1.0..60.0" {
            error-message "Invalid value for attribute 'interval'. Valid values are in range:[1.0,60.0]";
        }
    }
    default "13.0";
}

json2xml with

Input JSON

"interval": "13.0"

Generated XML

 <interval>13.</interval>

Expected XML

 <interval>13.0</interval>

This line is stripping the zeros json2xml.

Is this a bug or expected implementation?

llhotka commented 2 years ago

Fixed in PR #819. Thanks!

rawat-he commented 2 years ago

Much thanks for the quick fix.