fix(rabbitmq): using __routeArguments__
key to allow pipe injection
#648
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
@Param
decorator 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
DependenciesScanner
of 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.