Order of fields returned in a GraphQL query

When a GraphQL is sent to Stardog, the results are not returned in the same order as they were in the query.

See for example this snippet from the Stardog docs:


  Human(id: 1000) {


  "data": {
    "name": "Luke Skywalker",
    "id": 1000,
    "homePlanet": "Tatooine"

The graphQL spec (http://facebook.github.io/graphql/draft/) suggests:

GraphQL Objects represent a list of named fields, each of which yield a value of a specific type. Object values should be serialized as ordered maps, where the queried field names (or aliases) are the keys and the result of evaluating the field is the value, ordered by the order in which they appear in the query.

I realize that the latest draft says "should" and not "must|shall." However, it would be nice if Stardog would follow this suggestion.

That’s odd that the GraphQL would even suggest that since the JSON spec states that it’s unordered

An object is an unordered set of name/value pairs.

I would suggest not relying on it even if you could do it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.