Hello guys !
I'm nest with NestJS, and new with TS also. I'm trying to implement a basic API, and I have trouble to use the @ApiResponse while defining a list.
I was looking at this issue: https://github.com/nestjs/swagger/issues/41
But I clearly don't understand what's happening.
I'm trying something like this:
import { ApiModelProperty } from '@nestjs/swagger';
export class Location {
@ApiModelProperty()
id: string;
@ApiModelProperty()
name: string;
}
@Get()
@ApiResponse({
type: Location[],
})
findAll() {}
And I don't know how to configure the type to understand that I want a list of Location.
Thank you !
You should use isArray property ;)
@Get()
@ApiResponse({
type: Location,
isArray: true
})
findAll() {}
So simple ! Thank you very much !
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
You should use
isArrayproperty ;)