domaindrivendev / Swashbuckle.WebApi

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

creating different paths for multiple version #637

Open gilbertngandu opened 8 years ago

gilbertngandu commented 8 years ago

Hi, I would like to have the route template of my swagger doc in the following format swagger/docs/{type}/v{apiVersion}/ Eg: swagger/docs/mobile/v1/ swagger/docs/mobile/v2/ swagger/docs/wiget/v7/ etc... I am using multiple api versions as shown below and that works perfectly. In this the snippet below the ResolveVersionSupportByRouteConstraint function will find the correct controller c.MultipleApiVersions( (apiDesc, targetApiVersion) => ResolveVersionSupportByRouteConstraint(ref apiDesc, targetApiVersion), (vc) => { vc.Version("mobile.v0", "Default API"); vc.Version("widget.v1","Widget API v2"); vc.Version("widget.v2", "Widget API v2"); });

Oleksandr-Tokmakov commented 8 years ago

+1 , devs should allow to add custom parameters to route. Currently we can use {apiVersion} and {*assetPath} . Simple dictionary<string,string> in SwaggerDocsConfig and replace keys with values.