-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support dictionary in JSON for yang list statement #117
Comments
This is incompatible with JSON data representation as defined in RFC 7951 and cannot be used in RESTCONF either. It would be possible to write a special export method to produce such a JSON, but switching completely to this representation isn't possible. |
Hi, thanks for the quick reply.
This makes a lot of sense and it was never an intention of me to switch the format entirely.
My proposal would that
After a brief look at the code a change to |
I don't want to complicate the
|
The change I had in mind was on Regarding the order. Since python3.7 python dictionaries preserve order. Furthermore in older versions there is The code change is not so hard as it seems. From the top of my head it would be a change like this:
Having said all this.
|
Sec. 7.8.2 in RFC 7950: The "key" statement, which MUST be present if the list represents configuration and MAY be present otherwise, ....
Insertion order, yes. There is no way though to e.g. insert a new entry between two existing entries. |
Dear maintainers of the yangson library,
I would like to hear your opinions about the following feature.
Assume the following definition in a yang file.
Currently yangson demands that the corresponding JSON looks like this:
What do you think to additionally support also a JSON like this:
We are mostly using yang for human readable config files (as yaml files). So we prefer our users to write this in their yaml file.
Using a dictionary for 'list statement' seems in sync with the yang specification.
Since yang demand that each item of a list has a unique key (specified via the key keyword).
So if you think this would make sense I'll try to come up with a pull request.
The text was updated successfully, but these errors were encountered: