corenova / yang-js

YANG parser and composer
Apache License 2.0
56 stars 18 forks source link

Attribute under a namespace cannot be recognised correctly #90

Closed quantang closed 5 years ago

quantang commented 5 years ago

Hello @saintkepha,

Hope that you are not too busy these days. I am working to update my project with the latest yang-js. I noticed that some of my attributes are missing in the output with toJSON() function if they don't have an explicit namespace.

Such as:

    "ietf-network:networks": {
        "network": [
            {
                "network-id": "wireless.awc",
                "ietf-l2-topology:l2-network-attributes": {
                    "ietf-l2-topology:name": "wireless"
                },
            }
        ]
    }

If I removed the namespace of the "ietf-l2-topology:name" -> "name", the name attribute will not be in the toJSON() output. Based on my understanding, the namespace here should be optional, which should follow the parent's namespace if it is not given, right?

Cheers.