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

Unexpected order of properties in response #3256

Open
EmrysMyrddin opened this issue May 6, 2024 Discussed in #3218 · 1 comment
Open

Unexpected order of properties in response #3256

EmrysMyrddin opened this issue May 6, 2024 Discussed in #3218 · 1 comment

Comments

@EmrysMyrddin
Copy link
Collaborator

The problem

GraphQL operation results content should be stable, in particular the field order should be respected based on the query. This is a requirement of the GraphQL spec

Discussed in #3218

Originally posted by marceloverdijk March 31, 2024
I noticed having a query like:

query MyQuery {
  countries(first:100) {
    totalCount
    nodes {
      code
      name
      continent {
        name
      }
    }
  }
}

the response is:

{
  "data": {
    "countries": {
      "totalCount": 249,
      "nodes": [
        {
          "name": "Afghanistan",
          "code": "AF",
          "continent": {
            "name": "Asia"
          }
        },
        {
          "name": "Åland Islands",
          "code": "AX",
          "continent": {
            "name": "Europe"
          }
        },
  ..

In the response I would expect the order of the fields in the same order as requested.

But in the response the name field is before the code field.

This is quite annoying when testing an server, or even thinking about exposing a GraphQL service to (semi) business people that e.g. before used SQL to query data.

Is this something that can be configured?

@enisdenjo
Copy link
Collaborator

Can we get a repro? What does the schema with resolvers look like?

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

No branches or pull requests

2 participants