title: Explanation for different implementations of resolver function in graphql
body: <p>I've been reading through the graphQL docs and found that they've explained the implementation of the graphql server in 2 ways: one using graphql-yoga which is a fully featured graphql server and another one is using graphql, express-graphql and express. In both cases, we pass the schema and resolver functions while creating the server instance.</p>
  
  <p>But the implementation of resolver function differs. While using graphql-yoga, the resolver function is provided with 4 arguments which contains information about the parent object, arguments received, context, info. whereas in the other case (using graphql), the resolver function only gets the arguments object. </p>
  
  <p>Why is that so ? If I want the info, context objects, how do I get it ?</p>
  
  <p>Using graphql-yoga example: <a href="https://graphql.org/learn/execution/" rel="noreferrer">https://graphql.org/learn/execution/</a></p>
  
  <p>Using graphql example: <a href="https://graphql.github.io/graphql-js/mutations-and-input-types/" rel="noreferrer">https://graphql.github.io/graphql-js/mutations-and-input-types/</a></p>
  
  <p>// Code example using graphql</p>
  
  <pre><code>var express = require('express');
  var graphqlHTTP = require('express-graphql');
  var { buildSchema } = require('graphql');
  
  var schema = buildSchema(`
  type Query {
      rollDice(numDice: Int!, numSides: Int): [Int]
  }
  type Mutation {
      addDice(numDice: Int): String
  }
  `);
  
  var root = {
      rollDice({numDice, numSides}) {
          return [1, 2];
      },
      addDice({numDice}) {
          console.log("Adding something");
          return "Added";
      }
  };
  
  var app = express();
  app.use('/graphql', graphqlHTTP({
      schema: schema,
      rootValue: root,
      graphiql: true,
  }));
  app.listen(4000);
  console.log('Running a GraphQL API server at localhost:4000/graphql');
  </code></pre>
  
  <p>// Code example using graphql-yoga</p>
  
  <pre><code>let graphqlServer = require("graphql-yoga");
  
  const typeDefs = `
      type Query {
          rollDice(numDice: Int!, numSides: Int): [Int]
      }
      type Mutation {
          addDice(numDice: Int): String
      }
      `;
  
  const resolvers = {
      Query: {
          rollDice(parent, args, context, info) {
              console.log(args.numDice);
              console.log(args.numSides);
              return [1, 2];
          }
      },
      Mutation: {
          addDice(parent, args, context, info) {
              console.log(args.numDice);
              return "Added";
          }
      }
  };
  
  const server = new graphqlServer.GraphQLServer({
      typeDefs,
      resolvers
  });
  
  server.start(() =&gt; {
      console.log("server started on localhost:4000");
  });
  </code></pre>
  
  <p>Difference between these 2 code snippets:</p>
  
  <p>The resolver functions are present inside appropriate types (i.e. Query, Mutation) in one case. In the other case, they are present inside one root object. This means that I can have methods with same name in Query and Mutation in the first case, whereas in the second case that's not possible since they are keys of a single object and keys should be unique.</p>
  
  <p>Why is this so ? Am I basically missing something ? How can the implementation details differ from one package to another ?</p>