title: ASP.NET core model validation doesn't work as expected
body: <p>According to Microsoft documentation, if a model property is not-nullable, it is considered required by default, so there's no need to explicitly add the <code>[Required]</code> attribute.</p>
  
  <blockquote>
    <p>By default, the validation system treats non-nullable parameters or properties as if they had a [Required] attribute. Value types such as decimal and int are non-nullable.
    <a href="https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation?view=aspnetcore-2.2#required-attribute" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation?view=aspnetcore-2.2#required-attribute</a></p>
  </blockquote>
  
  <p>But that's not practically true. Let's say I have the following model:</p>
  
  <pre><code>public class Model
  {
      [Required]
      public string Name { get; set; }
      public int Age { get; set; }
  }
  </code></pre>
  
  <p>If the request doesn't contain <code>Age</code> in its body, a 0 is bound to the Age property and model validation doesn't fail. Even with <code>[Required]</code>, model validation still doesn't fail and 0 is assigned to <code>Age</code>. So how do I make properties with not-nullable types really "required"?</p>