title: How to create GraphQL Child Resolvers with Lambda
body: <p>I'm trying to create a mutation that calls a child resolver in addition to the parent resolver if an optional parameter is sent in.</p>
  <p>I'm using AWS AppSync to sent my queries to Lambda. AppSync creates and sends an <code>AppSyncEvent</code> to my resolver file that looks something like this:</p>
  <pre><code>{
  &quot;info&quot;: {
          &quot;parentTypeName&quot;: &quot;Mutation&quot;,
          &quot;selectionSetList&quot;: [
              ...
          ],
          &quot;selectionSetGraphQL&quot;: &quot;...&quot;,
          &quot;fieldName&quot;: &quot;updateUser&quot;,
          &quot;variables&quot;: {}
      }
  }
  </code></pre>
  <p>This event gets passed to my lambda function where, based on the <code>fieldName</code> and <code>parentTypeName</code>, I call my <code>updateUser</code> function.</p>
  <p>I have the below schema</p>
  <pre><code>schema {
    query: Query
    mutation: Mutation
  }
  
  type Query {
    getUser(id: ID!): User
  }
  
  type Mutation {
    updateUser(name: String, email: String, bookRead: BookReadInput): User
  }
  
  type User {
     name: String
     email: String
     booksRead: [Book]
  }
  
  type Book {
     title: String
     author: String
  }
  
  type BookReadInput {
     title: String
     author: String
  }
  </code></pre>
  <p>I want that if the mutation gets passed <code>bookRead</code> then it will know to call a child resolver called <code>addBook</code> besides for the regular <code>updateUser</code> resolver.</p>
  <p>I've seen various articles about implementing child resolvers but I can't figure out how they can work with lambda and the way my resolvers work.</p>