-
Notifications
You must be signed in to change notification settings - Fork 106
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
Change internal JSON Generation for OrderedMaps to be backwards-compatible #894
Conversation
should this behavior be controlled by a flag? |
I think this is not necessary because it preserves existing behaviour and AFAIK there is no user need for internal JSON format desiring the ordering property to be preserved. If there is a requirement then we can take a look. |
Should there be a TODO to remove this internal JSON? especially if it's not generated "incorrect" info |
I think this might be reasonable. @robshakir do you think it's reasonable to mark as "deprecated" the const (
// Internal is the custom JSON format that is output by the validation library, and
- // by pyangbind. It is loosely specified - but is the default used by generator developers.
+ // by pyangbind. It is loosely specified - but is used by some generator developers.
+ //
+ // Deprecated: Prefer RFC7951 to preserve list ordering, among other
+ // advantages.
Internal JSONFormat = iota |
I'll merge this now, but depending on Rob's comments I might add a deprecation notice. |
I did not consider JSON internal format for OrderedMaps and was generating it the same way as RFC7951.
However, Internal JSON format for YANG lists uses a JSON object/map type instead of JSON list to represent a map.
Doing this destroys the ordering and defeats the purpose of
ordered-by user
lists but it's more important to keep backwards-compatibility for this legacy JSON format.Also refactor code.