corenova / yang-js

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

Yang.compose() results in container undefined as root container for every input. #114

Closed eduardnegru closed 4 years ago

eduardnegru commented 4 years ago

For every value of config there is always a root container called "undefined" generated.

            const model = Yang.compose(config);
            const yangModel = model.toString(); 

Is this the desired behaviour? If yes, what is the purpose of having an undefined container every time?

sekur commented 4 years ago

As to the schema returning container undefined as the root, this is because the config JS object is not named and we need to describe that the config object as a container element. I believe there is an optional argument that we can specify into .compose in order to name the container.

sekur commented 4 years ago

The below will allow you to specify a name for the container.

Yang.compose(config, { tag: “my-config” })