As I used generated TypeScript DTOs, I never had issues having a dependency on the ServiceStack.dll.
For Blazor WASM, I understand that my ServiceModel must only reference ServiceStack.Interface.DLL to avoid dependencies that are incompatible with WASM (such as ServiceStack.DLL). I learnt this from Blazor wasm clash with ServiceStack.Script
My question is how can I use ServiceStack.FluentValidation in a way that is compatible with Blazor WASM, because it is not available via ServiceStack.Interfaces.
Should I simply relocate my service validators classes into the ServiceInterface layer?
It is best that your ServiceModel project has as few dependencies as possible. If you are declaring your custom validator classes, they can live in your ServiceInterface project as you’ve suggested. The ServiceModel project should only contain the minimum amount of info needed for client integration, so putting your validators with your service implementation (ServiceInterface) will avoid this problem
When you declare a validator using the AbstractValidator<T>, the T is usually your Request DTO. Eg
public class MyRequestValidator : AbstractValidator<MyRequest>
{
public MyRequestValidator()
{
RuleFor(x => x.Name).NotEmpty();
}
}
If this isn’t applicable to you, could you please provide a concrete example of your validator and issue you are having with them living in your ServiceInterface project?