Search code examples
graphqlgraphiql

How to add names to your GraphQL queries and mutations in GraphiQL?


What is the syntax for naming your GraphQL queries and mutations specifically from the GraphiQL GUI?


Solution

  • To add names to graphiql queries, simply add the name you want after the root type, as seen below. You will then have the option to run the query by name when you click the play button.

    query query_one {
    #some query in here
    }
    mutation mutation_one {
    #some mutation in here
    }
    

    enter image description here