-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Description
I'm submitting a...
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
I'm using nestjs-config in the current project. It provides method and parameter decorators for own config service (readme). It's @Configurable()
decorator replaces method's descriptor.value
with own function (source) and seems like this decorator breaks nestjs route decorator when it is located before these decorators. But all works fine when it is placed on the last place.
Broken example:
@Controller('cats')
export class CatsController {
constructor() {}
@Configurable() // <-- custom decorator at the top of order.
@Get('view') // <-- nestjs decorator won't work
@UseInterceptors(ImageInterceptor) // <-- nestjs decorator won't work
public async getMostLikedPosts(@ConfigParam('cats.limit') @Query('page') page: number): Cat[] {
// ... some implementation.
}
}
Broken example 2:
@Controller('cats')
export class CatsController {
constructor() {}
@Get('view') // <-- nestjs decorator will work fine
@Configurable() // <-- custom decorator in the middle of order.
@UseInterceptors(ImageInterceptor) // <-- nestjs decorator won't work
public async getMostLikedPosts(@ConfigParam('cats.limit') @Query('page') page: number): Cat[] {
// ... some implementation.
}
}
Working example:
@Controller('cats')
export class CatsController {
constructor() {}
@Get('view') // <-- nestjs decorator will work fine
@UseInterceptors(ImageInterceptor) // <-- nestjs decorator will work fine
@Configurable() // <-- custom decorator at the bottom of order
public async getMostLikedPosts(@ConfigParam('cats.sort') sort: string, @Query('page') page: number, @Query('limit') limit: number): Promise<Post[]> {
// ... some implementation.
}
}
Expected behavior
Custom decorators do not break break nestjs or described behavior is well documented.
Environment
Nest version: 5.3.11
For Tooling issues:
- Node version: 8.11.3 and 10
- Platform: Linux, Ubuntu 16.04
Metadata
Metadata
Assignees
Labels
No labels