What’s the right way to validate and transform parameters in Redis/TCP based NestJS microservice. I understand we can use pipelines and validators for API based microservices on HTTP. Should I be contended with manual validations? Are there examples for the same?
2
Answers
Here's the code that did the trick. Thanks to Jay McDoniel
Above filter goes into controller for it to kick-in when invoked
To support this filter, I have made my DTO validation like the code below
If you miss any of the required parameters, you'll see an exception like below
Pipes still work in microservices. You can create DTOs as you usually do for HTTP and bind the
ValidatioinPipe
in the same way.