Provide a way to validate messages, similar to ASP.NET Core MVC's model validation - https://docs.microsoft.com/aspnet/core/mvc/models/validation
Potential solution: https://github.com/envoyproxy/protoc-gen-validate. Either code generation of validation, or runtime validation.
I have a temporary solution for now.
I forked a repo and improved it to make efficient validation. It's based on FluentValidation that injects
Validator in the DI and the validation is processed within an interceptor.
The client can get the error list from a strongly-typed model. Works only with gRPC, Have to improve this for gRPC-web.
Hope it could help!
@JamesNK Is there any update on this issue? Code generated validation with https://github.com/envoyproxy/protoc-gen-validate is badly needed.
No. This isn't a high priority at the moment.
There is nothing stopping anyone from writing a library that inspects validation options defined in a proto file and uses them to validate Protobuf messages.
Most helpful comment
I have a temporary solution for now.
I forked a repo and improved it to make efficient validation. It's based on FluentValidation that injects
Validator in the DI and the validation is processed within an interceptor.
The client can get the error list from a strongly-typed model. Works only with gRPC, Have to improve this for gRPC-web.
Hope it could help!
https://github.com/AnthonyGiretti/grpc-aspnetcore-validator