title: How to validate a required query string field using model validation in ASP.NET Core
body: <p>Given following API</p>
  
  <pre><code>public class PagedRequest
  {
    [Required, Range(1, 100, ErrorMessage = "Limit must be from 1 to 100.")]
    public int Top { get; set; }
  
    [Required, Range(0, int.MaxValue, ErrorMessage = "Skip must be 0 or greater.")]
    public int Skip { get; set; }
  }
  
  [Route("test")]
  [HttpGet]
  public ActionResult&lt;BarResponse&gt; GetFoos([FromQuery] PagedRequest request)
  {
    if (!ModelState.IsValid) return BadRequest(ModelState);
  
    // Return 200 OK with data here
  }
  </code></pre>
  
  <p>Works as expected:</p>
  
  <ul>
  <li>test?skip=0&amp;top=10 -> returns 200 </li>
  <li>test?skip=0&amp;top=0 -> returns BadRequest with error messages</li>
  </ul>
  
  <p>Doesn't work as expected</p>
  
  <ul>
  <li>test?top=0, returns 200 OK, expected required field validation error for Skip field.</li>
  </ul>
  
  <p>Notes:</p>
  
  <ul>
  <li>Using ASP.NET Core 3.0</li>
  <li>This used to work with FromUri in ASP.NET Framework 4.x, then I'ld use a non-parameterless constructor, which is no longer allowed</li>
  </ul>