feat(common): Make ValidationPipe aware of WebSocket context #13255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extended logic of UsePipes and ValidationPipe decorators to give awareness of WebSocket context.
Closes #13190
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
This PR makes the ValidationPipe aware of being used in a WebSocket context. It is now correctly throwing a WsException instead of an internal server error when validation fails. It also moved the WsException into the common package, which is being referenced from the websockets package now.
What is the current behavior?
Issue 1390
Issue Number: 13190
What is the new behavior?
ValidationPipe now correctly returns WsException with validation error details when validation in WebSocket gateway is failing.
Does this PR introduce a breaking change?
Other information
This is my first open source contribution and I hope I adhered to all guidelines correctly.