I want to use FluentValidation in my API and I want to enforce every rule to get its ErrorCode defined, it cannot be "optional".
My goal is to provide a "dictionary" of errors making it easier for the client to implement its own handling and localization of error messages returned.
Is there any way to accomplish that?
FluentValidation in ASP.NET Core allows you to create custom validators and rules, which means you can implement your own validation logic to enforce the filling of the ErrorCode property.
You can create a base class for your custom validators that enforces the
ErrorCodeproperty.