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

Loosen must to should for serialization supporting ordered maps. #191

Merged
merged 1 commit into from
Jul 2, 2016

Conversation

leebyron
Copy link
Collaborator

@leebyron leebyron commented Jul 1, 2016

GraphQL should work correctly with many serialization techniques, not just JSON. Even within JSON, the GraphQL spec mentions ordered maps while the JSON spec describes unordered maps. This changes the language in the GraphQL spec to:

  • Use should instead of must where ordered map support might not be possible, thus supporting more environments.
  • Add clarifying language to JSON encoding section describing expectations for ordering.

Fixes #168

@ghost ghost added the CLA Signed label Jul 1, 2016
@leebyron leebyron force-pushed the loosen-ordered-map branch 2 times, most recently from 5eaa640 to db8e442 Compare July 1, 2016 22:06
@bruce
Copy link

bruce commented Jul 1, 2016

I added some commit comments to 5eaa640 with some suggestions.

@leebyron leebyron force-pushed the loosen-ordered-map branch from db8e442 to 733f8b5 Compare July 1, 2016 22:30
@leebyron
Copy link
Collaborator Author

leebyron commented Jul 1, 2016

Updated with your feedback

@leebyron leebyron force-pushed the loosen-ordered-map branch 3 times, most recently from f7d3141 to 949aea3 Compare July 2, 2016 00:09
the pairs are represented in an ordered manner. In other words, while the JSON
strings `{ "name": "Mark", "age": 30 }` and `{ "age": 30, "name": "Mark" }`
encode the same value, they also have observably different property orderings.
While not every JSON generator allows for control over the order in which
Copy link
Contributor

@dschafer dschafer Jul 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might remove this bit, and do something like:

From the above, the spec notes that "Serialization formats which can represent an ordered map should preserve the order of requested fields as defined by query execution." Hence, if the query was { name, age }, a GraphQL server vending JSON should respond with { "name": "Mark", "age": 30 }, preserving the order of the requested fields in the JSON serialization.

@leebyron leebyron force-pushed the loosen-ordered-map branch from 949aea3 to ef55027 Compare July 2, 2016 01:28
@leebyron
Copy link
Collaborator Author

leebyron commented Jul 2, 2016

Simplified a bit, including @dschafer's feedback

@leebyron leebyron force-pushed the loosen-ordered-map branch 3 times, most recently from f7917cd to 3da4a90 Compare July 2, 2016 01:36
GraphQL should work correctly with many serialization techniques, not just JSON. Even within JSON, the GraphQL spec mentions ordered maps while the JSON spec describes unordered maps. This changes the language in the GraphQL spec to:

* Use should instead of must where ordered map support might not be possible, thus supporting more environments.

* Add clarifying language to JSON encoding section describing expectations for ordering.

Fixes #168
@leebyron leebyron force-pushed the loosen-ordered-map branch from 3da4a90 to b22c73c Compare July 2, 2016 01:39
@leebyron leebyron merged commit 2e4d3ae into master Jul 2, 2016
@leebyron leebyron deleted the loosen-ordered-map branch July 2, 2016 01:48
@IvanGoncharov IvanGoncharov mentioned this pull request Oct 5, 2021
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

Successfully merging this pull request may close these issues.

3 participants