Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Help Wanted - Struggling To Understand Domain Validations - No Fluid Validation Error Messages Displayed In JSON Response #1248
Comments
|
Hi @dcs3spp, thank you for reaching out. There are multiple ways to implement validations for Domain layer. A detailed list can be found in Design validations in the domain model layer. Addition to that you would see The purpose of adding
Hope this helps ! |
|
Hi @dcs3spp , just checking if you had any further questions, or are we good for closure ? Thank you |
|
Hi @sughosneo |
|
Thanks for the update @dcs3spp . Closing it now. If you have any further questions, please feel free to reopen it. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.


Hi,
I am trying to understand DDD architecture and thus investigating the code for eShopContainers to aid my understanding.
I am struggling to understand validation of command data models using FluidValidation. Without adapting the source code further, the validation errors are not being displayed in a JSON response, however they are logged from within the ValidationBehaviour, so the FluentValidation rules are evidently receiving and validating the command. An example response is:
I have noticed that there is an extension method, AddCustomConfiguration. This initialises validation problem details from controller model state. I have tried inserting some console log statements before returning the bad request result but the InvalidModelStateReponseFactory handler does not seem to be activating, even though the AddCustomConfiguration extension method is invoked from ConfigureServices in startup.
The only way that I could get the fluid validation errors displayed is to modify the global exception filter as follows:
HttpGlobalExceptionFilter.cs
Not sure how validation is designed to work so that fluid validation error messages are displayed in JSON response. Is it the case that fluid adds the validation errors to the ModelState which then triggers the InvalidModelStateResponseFactory handler? If so, how do I configure fluid to do this since the handler is not activating? Why have both the response factory handler and the global exception handler?
I have double checked that the fluid validation behaviours are registered with MediatR