graphql.github.io icon indicating copy to clipboard operation
graphql.github.io copied to clipboard

Server GraphQL structure does not match the Query

Open RudiBoshoff opened this issue 4 years ago • 2 comments

Currently learning GraphQL and noticed an inconsistency in between:

type Query {
  hero: Character
  droid(id: ID!): Droid
}

and

query {
  hero {
    name
  }
  droid(id: "2000") {
    name
  }
}

Closes #

Description

RudiBoshoff avatar Apr 15 '21 12:04 RudiBoshoff

CLA Not Signed

Hi @RudiBoshoff thanks for contributing! There’s actually no error here since the argument for the field hero(episode: Episode): Character is optional (it has no !) you can query it without arguments (which you must do without parentheses).

benjie avatar Apr 16 '21 06:04 benjie

closing per @benjie 's comment

Urigo avatar Apr 09 '23 17:04 Urigo