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 response for inline spread #2195

Open
romshark opened this issue May 24, 2022 · 2 comments
Open

Unexpected response for inline spread #2195

romshark opened this issue May 24, 2022 · 2 comments

Comments

@romshark
Copy link

What happened?

The server returned an unexpected response for query А:

query A {
  todos {
    ... {
      id
      text
      user {
        id
      }
    }
  }
}

query B {
  todos {
    id
    text
    user {
      id
    }
  }
}

The response is broken:

{
  "data": {
    "todos": [
      {},
      {}
    ]
  }
}

Adding the ... @include(if:true) { directive doesn't help.

What did you expect?

I expect the same result as for query B:

{
  "data": {
    "todos": [
      {
        "id": "first",
        "text": "This is the first todo",
        "user": {
          "id": "first_creator"
        }
      },
      {
        "id": "second",
        "text": "This is the second todo",
        "user": {
          "id": "second_creator"
        }
      }
    ]
  }
}

Minimal graphql.schema and models to reproduce

# GraphQL schema example
#
# https://gqlgen.com/getting-started/

type Todo {
  id: ID!
  text: String!
  done: Boolean!
  user: User!
}

type User {
  id: ID!
  name: String!
}

type Query {
  todos: [Todo!]!
}

input NewTodo {
  text: String!
  userId: String!
}

type Mutation {
  createTodo(input: NewTodo!): Todo!
}

versions

  • go run github.com/99designs/gqlgen version: v0.17.7
  • go version: go1.18.2 linux/amd64
@frederikhors
Copy link
Collaborator

Can you please create a Github repo for reproduction? Thanks.

@romshark
Copy link
Author

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