ApiDefaultGetter
Set the default getter for the given type to the decorated method
@ApiDefaultGetter(type: any, parameter: string)
Parameters
Option | Type | Description |
---|---|---|
type
|
any |
The type for which the decorated function is the default getter |
parameter
|
string |
Name of the parameter in the route of the getter which corresponds to the id of the type |
Returns
MethodDecorator
See also
Description
This is to be used in conjunction with ApiProperty({link: () => Type})
to generate link objects
in the swagger schema
@Controller('users')
class UserController {
@Get(':userId')
@ApiDefaultGetter(UserGet, 'userId')
getUser(@Param('userId') userId: string) {
// ...
}
}