Closed icnocop closed 2 years ago
Hi @icnocop, I've been looking into this and noticed that this feature of FluentValidation relies on some MVC infrastructure to work and is only available in MVC applications. Based on this I'm going to close this issue.
Hi.
Thank you for Blazored.FluentValidation! 🙏
Description I'm seeing a discrepancy when validating a model with deeply nested child properties in Blazored.FluentValidation when compared to using FluentValidation in a Web API controller.
Blazored.FluentValidation doesn't seem to automatically pick up the validation rules for the deeply nested child properties.
To Reproduce Steps to reproduce the behavior:
POST
request to/api/Pets
with the following JSON body:Expected behavior I expected Blazored.FluentValidation to display the validation error message
• 'Street' must not be empty.
.Screenshots HTTP POST using Postman for example:
Hosting Model I've only tested with Blazor Server.
Additional context In
Startup.cs
, I'm automatically registering validators and implicitly validating child properties:Similar to https://github.com/Blazored/FluentValidation/issues/82#issuecomment-914898397, to work-around this issue, I have to explicitly set the validator on the child property by un-commenting the code on line 20 in
.\samples\BlazorServer\Models\Pet.cs
.Thank you! 🙏