You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] Regression
[ x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
I created these DTOs:
class ObjectDto {
@ApiProperty()
field: string;
}
export class HelloWorldDto {
@ApiProperty({
isArray: true,
type: ObjectDto,
})
arrayOfObjectsDto: ObjectDto[];
}
I would expect something like this:
As you can see, it's an actual array of objects.
I was able to get it to work by doing the following:
class ObjectDto {
@ApiProperty()
field: string;
}
export class Params {
@ApiProperty({
isArray: true,
type: ObjectDto,
})
arrayOfObjectsDto: ObjectDto[];
}
export class HelloWorldDto2 {
@ApiProperty()
params: Params;
}
As you can see, arrays seem to be declared correctly when they are located in the deeper level in the DTO.
However, this is not a viable option, since the path HelloWorldDto2.params actually doesn't exist...
Minimal reproduction of the problem with instructions
arnaud-cortisse
changed the title
Arrays of objects are not detected as such when located in first level of DTO
Arrays and objects are not managed properly when located in first level of @Query()
Dec 28, 2020
I'm submitting a...
Current behavior
I created these DTOs:
And expected them as query parameters:
I got the following output:
Expected behavior
I would expect something like this:
As you can see, it's an actual array of objects.
I was able to get it to work by doing the following:
As you can see, arrays seem to be declared correctly when they are located in the deeper level in the DTO.
However, this is not a viable option, since the path HelloWorldDto2.params actually doesn't exist...
Minimal reproduction of the problem with instructions
See https://github.com/arnaud-cortisse/nestjs-openapi-array-of-objects-bug
What is the motivation / use case for changing the behavior?
I want to be able to declare arrays of complex objects in the first level of DTOs
Environment
The text was updated successfully, but these errors were encountered: