I have a challenge with Swashbuckle or Swagger. I'm not sure if the problem is with Swagger or Swashbuckle. I have web api call, implemented both with the parameter as URI params, and with reading the content from the body of the request.
One is implemented like this:
[Route("application/uri")]
[HttpPost]
public async Task<string> Post([ModelBinder] Application application)
{
return await RegisterApplication(application);
}
The other is implemented like this:
[Route("loanapplication/json")]
[HttpPost]
public async Task<string> PostByJson(Application application)
{
return await RegisterApplication(application); ;
}
Both are using the same request objects, etc. The ApplicationRequest
class includes an enum, Purpose
. In the first service, the Swagger documentation is created beautifully, with nice documentation on each property in the Application
type, like this:
However, the second method, which uses standard HTTP body POST, generates a nice JSON example, but not with the allowable values in the enums. Is this a deficiency in Swashbuckle, in Swagger, or is it my lacking knowledge of how to use the tools?
This is what is generated from the second method:
As you can see, the "Purpose" includes just the first possible enum value. And the contextual description (provided on the ApplicationRequest
as Display attributes) are not displayed anywhere.