Skip to content

Ensure original declaration order for JSON string enums (#47)

Ole Krüger requested to merge ole.kruger/data-encoding:stable-enums into master

The Hashtbl that keeps the items of an enumeration also keeps the original index of each item. We can address #47 by using that index to recreate the original ordering.

This helps in making JSON schemas more stable. Normally, JSON schemas for enums would be shuffled around when a single new item is added. The new behaviour retains the original ordering - meaning if one adds a new item to the end of the list of enum items, it will also appear at the end in the JSON schema.

Edited by Ole Krüger

Merge request reports