title: Manually invoking modelstate validation fails in nested classes
body: <p>So, I have a class</p>
  
  <pre><code>public class Inventory
  {
      [Required]
      public Routing Routing { get; set; }
      [Required]
      public List&lt;Items&gt; Items { get; set; }
  }
  </code></pre>
  
  <p>And, Routing and Items are individual classes with their own validation parameters. </p>
  
  <pre><code>public class Routing 
  {
      [Required]
      public string SenderId { get; set; }
      [Required]
      public string ReceiverId { get; set; }
      public string PartnerId { get; set; }
      [Required]
      public string MessageType { get; set; }
  }
  </code></pre>
  
  <p>Now, I was using model validation in web API, it was working just fine. </p>
  
  <pre><code>public async Task&lt;IActionResult&gt; Post([FromBody] Inventory request, [FromQuery(Name = "CorrelationId")] string correlationId)
  {
      ....
      // Working just fine, validating the incoming request schema as defined by Inventory class
  }
  </code></pre>
  
  <p>If user/consumer sends POST request with the wrong schema, it fails at HTTP level and shows 400 BAD Request, and control does not even come inside the <code>Post</code> method body. I want the control to come inside <code>Post</code> method.</p>
  
  <p>Now, I am doing manual validation</p>
  
  <pre><code>public async Task&lt;IActionResult&gt; Post([FromBody] string request, [FromQuery(Name = "CorrelationId")] string correlationId)
  {
      Inventory obj = JsonConvert.DeserializeObject&lt;Inventory&gt;(request);
      var context = new ValidationContext(obj, serviceProvider: null, items: null);
      var validationResults = new List&lt;ValidationResult&gt;();
      bool isValid = Validator.TryValidateObject(obj, context, validationResults); 
  
      if (!isValid)
      {
          // Valid even if I omit some parameters of nested classes Routing or Items 
          foreach (var validationResult in validationResults)
          {
              Console.WriteLine(validationResult.ErrorMessage);
          }
      }
  } 
  </code></pre>
  
  <p>Now, if I do, say, omit a <code>SenderId</code> from <code>Routing</code> class, it is showing Valid in the above manual validation. </p>
  
  <p>What I want:- Schema/Model validation inside the <code>Post</code> method, and if invalid, list of all errors inside the <code>Post</code> method. </p>