Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swagger: support for optional routes

I have a route with an optional parameter:

    [Route("{categoryId?}")]
    public HttpResponseMessage Get(int? categoryId=null)

However, when I don't provide a value for categoryId the call includes {categoryId?} in the request itself...

http://myhost/api/%7BcategoryId%7D
like image 498
Dunken Avatar asked May 12 '15 05:05

Dunken


1 Answers

Swagger has no support for optional path parameters. If you wish to document it this way, you'd have to create two separate paths - one without the path parameter and one with.

like image 80
Ron Avatar answered Oct 04 '22 15:10

Ron