-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loosen must to should for serialization supporting ordered maps.
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
- Loading branch information
Showing
2 changed files
with
21 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,9 +21,8 @@ representations of the following four primitives: | |
* String | ||
* Null | ||
|
||
Serialization formats which only support an ordered map (such as JSON) must | ||
preserve ordering as it is defined by query execution. Serialization formats | ||
which only support an unordered map may omit this ordering information. | ||
Serialization formats which can represent an ordered map should preserve the | ||
order of requested fields as defined by query execution. | ||
|
||
A serialization format may support the following primitives, however, strings | ||
may be used as a substitute for those primitives. | ||
|
@@ -53,6 +52,19 @@ the following JSON concepts: | |
| Float | Number | | ||
| Enum Value | String | | ||
|
||
**Object Property Ordering** | ||
|
||
While JSON Objects are specified as an | ||
[unordered collection of key-value pairs][rfc7159-sec4] the pairs are | ||
grammatically 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 grammatical property | ||
orderings. While not every JSON generator allows for control over the order in | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bruce
|
||
which properties are written, many do and if so should produce JSON objects with | ||
properties in the same grammatical order as those fields were requested as | ||
defined by query execution. | ||
|
||
[rfc7159-sec4]: https://tools.ietf.org/html/rfc7159#section-4 | ||
|
||
|
||
## Response Format | ||
|
👍