title: ValidateModel does not work asp.net core 3.0
body: <p>I trust you doing good, I am new to <code>.net core API</code>, I am doing a model validation, seems like it does not work, </p>
  
  <p>Controller Action : </p>
  
  <pre><code>[HttpPost]
      [ValidateModel]
      [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(ActionLog))]
      [ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ActionLog))]
      [ProducesResponseType(StatusCodes.Status401Unauthorized)]
      public async Task&lt;IActionResult&gt; CreateAsync([FromBody] ActionLog document)
      {
          try
          {
              if (ModelState.IsValid)
              {
                  var result = await this.documentRepository.CreateAsync(document);
                  return this.StatusCode(StatusCodes.Status201Created,document.Id);
              }
              else
              {
                  return this.StatusCode(StatusCodes.Status400BadRequest);
              }
          }
          catch (Exception)
          {
              return this.StatusCode(StatusCodes.Status500InternalServerError, "Internal Server Error");
          } 
      }
  </code></pre>
  
  <p>Model Class</p>
  
  <pre><code>public class ActionLog : ILogDocument
   {
      /// &lt;summary&gt;
      /// Gets or sets the identifier.
      /// &lt;/summary&gt;
      /// &lt;value&gt;
      /// The identifier.
      /// &lt;/value&gt;
      [BsonElement("id")]
      [BsonId(IdGenerator = typeof(ObjectIdGenerator))]
      public ObjectId Id { get; set; }
  
      /// &lt;summary&gt;
      /// Gets or sets the source identifier.
      /// &lt;/summary&gt;
      /// &lt;value&gt;
      /// The source identifier. Used to identify which source the log came from.
      /// &lt;/value&gt;
      [BsonRequired]
      [BsonElement("sourceId")]
      public string SourceId { get; set; }
  
      /// &lt;summary&gt;
      /// Gets or sets the keywords.
      /// &lt;/summary&gt;
      /// &lt;value&gt;
      /// The keywords associated to the log.
      /// Those keywords allow for faster searches compared to a full-text search on the payload.
      /// This should be used as much as possible for common actions like: subject, type of action or target resource.
      /// &lt;/value&gt;
      [BsonElement("keywords")]
      public string[] Keywords { get; set; } = Array.Empty&lt;string&gt;();
  
      /// &lt;summary&gt;
      /// Gets or sets the payload of the action log (usually more detailed data).
      /// &lt;/summary&gt;
      /// &lt;value&gt;
      /// The payload.
      /// &lt;/value&gt;
      [BsonElement("payload")]
      public string Payload { get; set; } = string.Empty;
  
      /// &lt;summary&gt;
      /// Gets or sets the date of event occurrence.
      /// &lt;/summary&gt;
      /// &lt;value&gt;
      /// The date.
      /// &lt;/value&gt;
      [BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
      [BsonElement("date")]
      public DateTime Date { get; set; } = DateTime.UtcNow;
  }
  </code></pre>
  
  <p>Apart from that I have not coded any configurations in other classes or configuration, It returns 201 for every request. </p>
  
  <p>reference : <a href="https://docs.microsoft.com/en-us/aspnet/web-api/overview/formats-and-model-binding/model-validation-in-aspnet-web-api" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/web-api/overview/formats-and-model-binding/model-validation-in-aspnet-web-api</a></p>