domaindrivendev / Swashbuckle.WebApi

Seamlessly adds a swagger to WebApi projects!
BSD 3-Clause "New" or "Revised" License
3.07k stars 678 forks source link

Swagger skips Web Api actions with ValueProvider attribute in request parameter #1095

Open ekonor opened 7 years ago

ekonor commented 7 years ago

In some of my controller actions I have to use ValueProvider attribute like this:

[Route("{id}")]
[HttpGet]
public async Task<IHttpActionResult> Get([ValueProvider(typeof(MyValueProviderFactory))] long id)
{
   ////
}

Actions like this one are skipped in swagger documentations. They are already skipped when I get into my custom Document and Operation filters so I can't do anything about it.

heldersepu commented 7 years ago

There might be something else going on, it works fine for me...

heldersepu commented 7 years ago

Here is my test controller using a ValueProvider: https://github.com/heldersepu/SwashbuckleTest/blob/master/Swagger_Test/Controllers/ValueProviderController.cs And here is how it looks like in swagger: http://swashbuckletest.azurewebsites.net/swagger/ui/index#!/ValueProvider/ValueProvider_Get

ekonor commented 7 years ago

Thanks for reply, Yeah, i've checked. Problem is revealed in combination of using ValueProvider attribute and [Route("{id}")] or [RoutePrefix("api/v1/mycontroller/{id}/operations")] If I remove Route attribute, action is apearing in swagger

heldersepu commented 7 years ago

We do have a history of issue with the routes and binding attributes, see issue #1058