title: Is it possible to validate an enumerable model using FluentValidation without enabling implicit validation of child properties?
body: <p>Given the following model, validator and controller (in ASP.NET Core 3.1):</p>
  <pre class="lang-cs prettyprint-override"><code>public sealed class Model
  {
      public string Property { get; set; }
  }
  
  public sealed class ModelValidator : AbstractValidator&lt;Model&gt;
  {
      public ModelValidator()
      {
          RuleFor(m =&gt; m.Property).NotEmpty();
      }
  }
  
  [ApiController]
  [Route(&quot;[controller]&quot;)]
  public sealed class TheController : ControllerBase
  {
      [HttpPost]
      public IActionResult PostSomething(IEnumerable&lt;Model&gt; model)
      {
          // Do something
          return Ok();
      }
  }
  </code></pre>
  <p>Is there a way of validating the <code>IEnumerable&lt;Model&gt;</code> model of <code>TheController.PostSomething</code> without enabling <code>ImplicitlyValidateChildProperties</code> in my startup class like below?</p>
  <pre class="lang-cs prettyprint-override"><code>services.AddControllers()
      .AddFluentValidation(c =&gt; c.ImplicitlyValidateChildProperties = true);
  </code></pre>
  <p>I have, so far, been unable to find a way of successfully validating the enumerable model without setting <code>ImplicitlyValidateChildProperties = true</code>.</p>
  <p><strong>Update</strong>: when changing the signature of <code>PostSomething</code>, and adding and registering an additional validator (as below) validation does occur.</p>
  <pre class="lang-cs prettyprint-override"><code>[HttpPost]
  public IActionResult PostSomething(List&lt;Model&gt; model)
  {
      // Do something
      return Ok();
  }
  
  public sealed class ListOfModelValidator : AbstractValidator&lt;List&lt;Model&gt;&gt;
  {
      public ListOfModelValidator()
      {
          RuleForEach(m =&gt; m).SetValidator(new ModelValidator());
      }
  }
  </code></pre>
  <p>However, this feels wrong. It also causes a problem with the <code>ValidationProblemDetails</code> response that is returned. The index of the element with the validation error will have the name of the lambda parameter prefixed, so instead of <code>[0].Property</code> it will be <code>m[0].Property</code>. I have been unable to to find a way of removing the name of the lambda parameter, either using <code>WithName</code> or a custom <code>DisplayNameResolver</code>.</p>
  <p>However, this approach feels wrong. I'd rather not have to change the signature of <code>PostSomething</code> or add something that feels like a kludge to remove the lambda parameter name.</p>
  <p>While I could just enable <code>ImplicitlyValidateChildProperties</code> it has the potential to cause problems with some changes that I need to make so I would prefer to avoid it if possible.</p>