-
Notifications
You must be signed in to change notification settings - Fork 86
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
ROUTE_ARGS_METADATA missing after using @Transactional decorator #15
Comments
Hi @labibramadhan, So according to your suggestion, every decorator need to be changed if used together with NestJS. This does not sound reasonable to me. Did you try to change the order of decorator declarations? @Transactional()
@Post() // first the nestJS decorator is fetching the metadata of the method params
async create(@Body() createCatDto: CreateCatDto) {
this.catsService.create(createCatDto);
} |
Yeah i tried to reorder and put the |
Ok, I will try to find the time to investigate that a bit more, since there is no special code here, just a simple decorator. Cheers |
I've also just hit this issue, looks like another 3rd party library may have faced something similar before. Found some links that may help: |
Seems there is already a PR to fix this from @labibramadhan #16 |
#16 Merged - Closing this issue. |
When
@Transactional
is being used on a method, the method decorator@Body()
,@Param()
, and@Query()
documentations will be gone later on the Swagger docs.Below is my inspections:
Here is
@nestjs/common
injecting ROUTE_ARGS_METADATA to controller methods by using its method name as the key, the ROUTE_ARGS_METADATA itself is mainly stored on thetarget.constructor
which is the class where the method is defined, this is going to be used later for@nestjs/swagger
to explore available methods/endpoints and its object structure as well that can be found hereThe problem is that
@Transactional
is overwriting the method without preserving the method name, this makes thecreatePipesRouteParamDecorator()
function of@nestjs/swagger
will not find any kind of ROUTE_ARGS_METADATA that have been previously stored by@nestjs/common
, because the key itself to retrieve ROUTE_ARGS_METADATA stored on the class is the method nameThe text was updated successfully, but these errors were encountered: