Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Default Version Swagger Location

Using Swashbuckle in conjuntion with c.MultipleApiVersions((apiDesc, version) =>... the result is our swagger file resides at eg: https://host/api/swagger/docs/{version}. I would like to actually have the swagger file at https://host/api/{version}/swagger. Is it possible the I can set this up in my SwaggerConfig .EnableSwagger()?

This would allow for the following Urls :

http://host/api/v1/swagger/

http://host/api/v2/swagger/

Appreciate the help.

like image 244
Mike Avatar asked Feb 06 '23 00:02

Mike


1 Answers

To do that way, you can update the swaggerconfig file as shown below:

.EnableSwagger("{apiVersion}/swagger", c =>
        {
            c.MultipleApiVersions(
                (vc) =>
                {
                    vc.Version("v2", "Swashbuckle Dummy API V2");
                    vc.Version("v1", "Swashbuckle Dummy API V1");
                });
        });
like image 179
Silly John Avatar answered Feb 08 '23 15:02

Silly John