How do I get Swagger UI to provide a text box for POST body content?

205 views Asked by At

Our ASP.NET Core app has an endpoint which reads the Request.Body stream directly rather than using endpoint parameters and [FromBody].

[HttpPost("event")]
public Task PostEvent(string clientId)
{
    _someService.HandleEvent(clientId, Request.Body);
}

This works great, but the Swagger UI doesn't provide a text box for the body content because it's not in the method signature.

1

Is there a way to easily get Swagger to provide a <textarea> element for the body content?

1

There are 1 answers

0
dantz On

I am currently trying this in Azure Functions and found this attribute for me: [RequestBodyType(typeof(TestModel), "testmodel")]

link here

Hopefully this will give you some hint to find something similar