Programmer89
Programmer89

Reputation: 195

ApiProperty not reflecting the type of data i want

I'm creating a POST endpoint that will receive an object with one property: returnIds. This return ids will be an array of NUMBERS

{
  "returnIds": [1, 2, 3, 4, 5]
}

For this i create this DTO

 @ApiProperty()  
 returnIds: number[]

The problem is that swagger is showing me this

enter image description here

what i need to change that the shown example is instead "string" a 0 or something related with a number?

This is my endpoint

enter image description here

Thank u a lot

Upvotes: 3

Views: 3053

Answers (1)

Jay McDoniel
Jay McDoniel

Reputation: 70111

You can use @ApiProperty({ type: [Number] }) to designate it's supposed to be an array of numbers. Just like it's mentioned in the docs

Upvotes: 4

Related Questions