title: AWS AppSync vtl make set null if argument is empty list
body: <p>I want to update a 'person' item in my table.
  I want to update the persons name and his set of skills.
  It's also possible that we just use the <code>updatePerson</code> mutation to update the name. And we will update the skills later.</p>
  <p>At that point the argument 'skills' is an empty list. However DynamoDB does not allow for empty sets.</p>
  <p>Currently I am trying to work around this by first checking if the skills argument is an empty list. But it is still telling me <em><strong>&quot;An string set  may not be empty for key :skills&quot;</strong></em>.</p>
  <p>This is my current request mapping template, but atm the <code>isNullOrDefault</code> check does not work.</p>
  <pre><code>#if ($util.isNullOrEmpty($context.arguments.skills))
    #set ($skills = $utils.dynamodb.toNullJson())
  #else
    #set ($skills = $utils.dynamodb.toStringSetJson($context.arguments.skills))
  #end
  
  {
    &quot;version&quot; : &quot;2018-05-29&quot;,
    &quot;operation&quot; : &quot;UpdateItem&quot;,
    &quot;key&quot;: {
      &quot;id&quot; : $utils.dynamodb.toDynamoDBJson($context.arguments.id)
    },
    &quot;update&quot; : {
      &quot;expression&quot; : &quot;set #name = :name, #skills= :skills,
      &quot;expressionNames&quot; : {
        &quot;#name&quot;: &quot;name&quot;,
        &quot;#skills&quot;: &quot;skills&quot;,
      },
      &quot;expressionValues&quot; : {
        &quot;:name&quot; : $utils.dynamodb.toDynamoDBJson($context.arguments.name),
        &quot;:skills&quot; : $skills,
      }
    }
  }
  </code></pre>
  <p>Do you know how I can set the set of skills if the skills argument is not an empty array and not set it if the skills argument is an empty array?</p>