title: Relational mutations in Graphql AWS Amplify
body: <p>I have the following Graphql schema with relationship, configured with AWS Amplify:</p>
  <pre><code>type Product @model{
    id: ID! @primaryKey
    name: String!
    img: String!
    components: [Component]! @hasMany
    categories: [Category]! @hasMany
  }
  type Component @model{
    id: ID! @primaryKey
    name: String!
  }
  type Category @model{
    id: ID! @primaryKey
    name: String!
  }
  </code></pre>
  <p>A product can have multiple components and multiple categories.</p>
  <p>I would like to have a mutations that can allow me to create a Product and also the components and categories associated.</p>
  <p>Amplify codegen already created the mutation &quot;CreateProduct&quot; but it don't allow me to specify the component and category data in order to create them and link to the product.</p>
  <p>It seems that i must create the product first and then the component and category separately.</p>
  <p>I need to write a custom mutation in order to do what i want or it's impossible?</p>
  <p>If it's possible with a custom mutation, how can I write it?</p>
  <p>I saw for example that Fauna have this feature, with &quot;create&quot; instruction:
  <a href="https://docs.fauna.com/fauna/current/api/graphql/relationships#mutations" rel="nofollow noreferrer">https://docs.fauna.com/fauna/current/api/graphql/relationships#mutations</a></p>
  <p>Thank you!</p>