This repository was archived by the owner on Jul 25, 2024. It is now read-only.
FIX: Ordering of fields (WIP) #51
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: this is a WIP commit to solicit feedback only. It is far from complete.
The GraphQL spec says the order of the fields in the output should match
the order specified in the query.
Maps in Elixir do not provide a way to traverse the keys in source
order and maps are currently used to hold fields in query definitions
and during execution.
This means order of fields in the output is non-deterministic right now.
The fix for this is to use keyword lists instead of maps in query
definitions and during execution.
A further complication is that Poison (used in the plug) cannot encode
keyword lists, so we'd need to have some alternative solution for
transforming the literal query results into JSON.