title: How to make FluentValidation ignore a property
body: <p>I have the following View Model</p>
  
  <pre><code>public class MyViewModel
  {
      public MyViewModelClassWithValidator MandatoryProperty {get; set;}
      public MyViewModelClassWithValidator OptionalProperty {get; set;}
  
      public class MyViewModelValidator : AbstractValidator&lt;MyViewModel&gt;
      {
          public MyViewModelValidator()
          {
              RuleFor(x=&gt; x.MandatoryProperty) //...
              //No rule for property 2
          }
      }
  }
  </code></pre>
  
  <p>I'm looking for a way to make the OptionalProperty ignored by FluentValidation. Here, the validation errors of Optional Property still get added to the ModelState.</p>
  
  <p><a href="https://stackoverflow.com/questions/8991314/selective-validation-of-child-properties-fluent-validation-in-mvc">This answer</a> suggests either 1. to avoid reusing the child model, but this is not an option in my case, and 2.  to delete the errors from the ModelState. Before writing a dirty class to get the ModelState from the HttpContext, I'd like to know if there's an other way I'm unaware of since the answer is old.</p>
  
  <p>My objective is to keep the validation logic encapsulated in my ViewModels.</p>
  
  <p>Thank you</p>