Ir al contenido

Missing Api Response Type (ARCH3201)

Esta página aún no está disponible en tu idioma.

Key typescript.quality.missing-api-response · Severity info · Category quality

HTTP controller actions that don’t declare their response schema and status codes leave the generated OpenAPI documentation incomplete and the client contract ambiguous. The response type should be declared explicitly.

@Get(":id")
findOne(@Param("id") id: string) {
return this.svc.find(id);
}
@Get(":id")
@ApiResponse({ status: 200, type: UserDto })
@ApiResponse({ status: 404 })
findOne(@Param("id") id: string): Promise<UserDto> {
return this.svc.find(id);
}

Declare each action’s response type and status codes with schema decorators.