fix(rabbitmq): using __routeArguments__ key to allow pipe injection#648
Merged
underfisk merged 1 commit intogolevelup:masterfrom Sep 27, 2023
Merged
Conversation
__routeArguments__ key to allow pipe injection
89f0afe to
637396b
Compare
637396b to
b1cffbc
Compare
Collaborator
|
Thank you for pushing this PR. |
Contributor
Author
|
At least I haven't observed any problems with this until now. I'll try working with this a bit more over the next one or two weeks, and report back if there have been any unexpected bugs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #645
nestjs regular
@Paramdecorator and such adds the pipes to the metadata (via the reflection methods) using the'__routeArguments__'key (https://github.com/nestjs/nest/blob/93b99d09ed84640815fc3aa99196cf94e692bc4d/packages/common/decorators/http/route-params.decorator.ts#L80)The
DependenciesScannerof nestjs then loads the'__routeArguments__'and injects the pipes inreflectParamInjectables(https://github.com/nestjs/nest/blob/master/packages/core/scanner.ts)golevelup/nestjs however uses the
'RABBIT_ARGS_METADATA'key for it (https://github.com/golevelup/nestjs/blob/c927cb12f5203fe4739027fc54d78c6ae2629cfb/packages/rabbitmq/src/rabbitmq.decorators.ts), so the scanner will never load and inject them.I just changed it to
'__routeArguments__', and then pipes were correctly created, and their dependencies injected. I don't know enough about the internals to judge if this causes other side-effects. Hopefully tests will catch it all. I wasn't able to run tests locally, so I'm waiting for the ci pipeline to run.