我有一个基本的控制器设置:
@Controller('')
export class AController {
@Get(':id')
async getThing(@Param('id', ParseUUIDPipe) id: string): Promise<RegisterRead[] | IntervalRead[]> {
return id
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Validation failed (uuid vundefined is expected)"
}
Run Code Online (Sandbox Code Playgroud)
这个问题是因为我没有指定版本。它将版本显示为可选字段,但似乎是必需的:
new ParseUUIDPipe({version: '4'})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1744 次 |
| 最近记录: |