Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request body not showing in Nest.js + Swagger

My controller code is something like this.

@Controller('customer')
export class CustomerController{

    constructor(private readonly customerService: CustomerService){}

    @Post('lookup')
    async someMethod(@Body() body:any){

        console.log("BEGIN -- CustomerController.someMethod");

I am expecting to see in Swagger a place where I can input some text as a request body but instead I see this

enter image description here

like image 247
p0tta Avatar asked Sep 07 '25 01:09

p0tta


1 Answers

Add @ApiProperty()

export class User{

 @ApiProperty()
  name:string
 
}
like image 52
Tokiniaina Eddy Andriamiandris Avatar answered Sep 10 '25 05:09

Tokiniaina Eddy Andriamiandris