title: Remove errors of type Required from ModelState
body: <p>I want to ignore the errors of type <code>Required</code> from the model state, in case of PATCH http request, wherein I am allowing partial updates:</p>
  
  <pre><code>public class ValidateModelFilterAttribute : ActionFilterAttribute
  {
      public override void OnActionExecuting(ActionExecutingContext context)
      {
  
          if (!context.ModelState.IsValid &amp;&amp; context.HttpContext.Request.Method == "PATCH")
          {
  
              // can't figure out this part
              var modelStateErrors = context.ModelState.Keys.SelectMany(key =&gt; context.ModelState[key].Errors);
              // get errors of type required from the modelstate
              // context.ModelState.Remove("attribute_which_failed_due_to_required");
  
  
          }
          if (!context.ModelState.IsValid)
          {
              var modelErrors = new Dictionary&lt;string, Object&gt;();
              modelErrors["message"] = "The request has validation errors.";
              modelErrors["errors"] = new SerializableError(context.ModelState);
              context.Result = new BadRequestObjectResult(modelErrors);
          }
      }
  }
  </code></pre>
  
  <p>Controller Action:</p>
  
  <pre><code>[ValidateModelFilter]
  [HttpPatch("{id}")]
  public virtual async Task&lt;IActionResult&gt; Update([FromRoute] int id, [FromBody] TEntity updatedEntity)
  {
      TEntity entity = repository.GetById&lt;TEntity&gt;(id);
      if (entity == null)
      {
          return NotFound(new { message = $"{EntityName} does not exist!" });
      }
      repository.Update(entity, updatedEntity);
      await repository.SaveAsync();
      return NoContent();
  }
  </code></pre>
  
  <p>So, how can I filter out "required" type errors and remove them from the model state. </p>