Skip to content
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

Fields are unordered #101

Open
alanvgreen opened this issue Nov 6, 2024 · 0 comments
Open

Fields are unordered #101

alanvgreen opened this issue Nov 6, 2024 · 0 comments

Comments

@alanvgreen
Copy link

I'm writing a web app that shows details from data contracts, and noticed that the fields are displayed in a different order to how they are in the Data Contract. This is a little confusing to users who are trying to understand a data model and find that - for example - the volume and price of an order are separated by eight unrelated columns. There may also be cases, such as CSV files, where the ordering of fields is an important part of the contract between data provider and data user.

In the Data Contract Specification, fields are represented as a YAML Mapping, mapping field names to data about that field. The YAML 1.2 spec, at section 3.2.1.1 explicitly notes that mapping key/value pairs are unordered:

The content of a mapping node is an unordered set of key/value node pairs, with the restriction that each of the keys is unique.

Many tools (e.g modern PyYAML) preserve the order of keys as read from the file, but some others do not.

It would be helpful if a future version of the Data Contract specification had some way to explicitly order fields. A YAML list is a possible solution, but many others exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant