You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the result of evaluating a selection set is ordered, the serialized Map of results should preserve this order by writing the map entries in the same order as those fields were requested as defined by selection set execution. Producing a serialized response where fields are represented in the same order in which they appear in the request improves human readability during debugging and enables more efficient parsing of responses if the order of properties can be anticipated.
Serialization formats which represent an ordered map should preserve the order of requested fields as defined by [CollectFields](https://spec.graphql.org/October2021/#CollectFields())() in the Execution section. Serialization formats which only represent unordered maps but where order is still implicit in the serialization’s textual order (such as JSON) should preserve the order of requested fields textually.
For example, if the request was { name, age }, a GraphQL service responding in JSON should respond with { "name": "Mark", "age": 30 } and should not respond with { "age": 30, "name": "Mark" }.
While JSON Objects are specified as an [unordered collection of key-value pairs](https://tools.ietf.org/html/rfc7159#section-4) 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.
pg_graphql currently serializes with jsonb for efficiency.
Technically
Serialization formats which only represent unordered maps but where order is still implicit in the serialization’s textual order (such as JSON) should preserve the order of requested fields textually.
would not include JSONB. However, 90% of the users of this lib are accessing values as JSON via PostgREST so thats not a great answer.
This task is to check (and document here) the performance impact of using JSON vs JSONB
If the impact is small enough, updating the transpiler to make sure responses are all in the correct order
The text was updated successfully, but these errors were encountered:
The GraphQL spec notes
pg_graphql currently serializes with jsonb for efficiency.
Technically
would not include JSONB. However, 90% of the users of this lib are accessing values as JSON via PostgREST so thats not a great answer.
This task is to check (and document here) the performance impact of using JSON vs JSONB
If the impact is small enough, updating the transpiler to make sure responses are all in the correct order
The text was updated successfully, but these errors were encountered: