6
votes

Is there a way (or a shortcut) to populate all fields of a Query?

Let's take https://graphql.org/swapi-graphql/ as an example.

I know that by ctrl + space I can invoke the autosuggest. enter image description here

But what if I wanted to populate all of the fields (name, height etc..) without having to manually type them out?

2
there's no way to do this imo.itaintme

2 Answers

1
votes

Execute the query without specifying the child fields

graphiql will kindly fill in each field for you. In your case:

{
    person(personID: 1)
}

will autocomplete to

{
  person(personID: 1) {
    name
    birthYear
    eyeColor
    gender
    hairColor
    height
    mass
    # etc...
  }
}
0
votes

Generally, if you enter the base type without the paramaters like shown below the fields will populate when you "Ctrl-Enter or press the play button" directly after it. Strangely, I don't see it happening on that example url provided but it is functioning for me using a GraphpliQL interface that I am using through Prismic.

{
    person
}