Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(common): Make ValidationPipe aware of WebSocket context #13255

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

floriantoenjes
Copy link

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.

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

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?

  • Yes
  • No

Other information

This is my first open source contribution and I hope I adhered to all guidelines correctly.

Extended logic of UsesPipes and ValidationPipe decorators to give awareness of WebSocket context.

Closes nestjs#13190
@coveralls
Copy link

Pull Request Test Coverage Report for Build cb257d08-6615-4066-aa8e-e15f3c7fd5ee

Details

  • -8 of 31 (74.19%) changed or added relevant lines in 8 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.08%) to 92.079%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/common/decorators/core/use-pipes.decorator.ts 3 4 75.0%
packages/common/pipes/validation.pipe.ts 11 18 61.11%
Totals Coverage Status
Change from base Build 086b893a-64dc-49ed-b1bd-71bc94aca6ea: -0.08%
Covered Lines: 6742
Relevant Lines: 7322

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValidationPipe and possibly others throw HttpException when used on WS gateways
2 participants