3
votes

I would like to customize request body in swagger-ui generated with SwashBuckle for .Net Core.

I need that when user click on "Try it Out" in swagger-ui, the request body to be different from the [FromBody] model in my Controller API.

The reason for this is because my [FromBody] Model is an "object" type. So, the request body appears {} on Swagger-Ui.

I am using .Net Core 2.1 and SwashBuckle 4.0.1.

Thanks

1
did you got it sorted? I am also trying to edit the request body. In my case request comes with type of each parameter as value, when user clicks on try it out. I want this to be empty instead of string - Saad Khan
@SaadKhan Khan I did not get... to resolve, I put a request body that I want, with annotations, in controller. But it stay fixed on top of service in swagger-ui.... - marcosautomacao

1 Answers

-1
votes

In the model you have to put the set; characteristic in the model request since that way swagger grabs the object and sets it into the request.

Model describer

Swagger describer

Swagger