GWilkinson
GWilkinson

Reputation: 107

Add Swagger File to Swashbuckle

I am currently using Swashbuckle to document my .Net API which is a great tool. I wanted to know whether I can add additional swagger files being stored within my project.

I have saw the following code from the swashbuckle documentation and tried this but it doesn't seem to work:

.EnableSwagger("docs/{apiVersion}/swagger", c => c.SingleApiVersion("v1", "A title for your API"))
.EnableSwaggerUi("sandbox/{*assetPath}");

The overall aim would be to have to option of using swagger from my generated project XML file and be able to add additional swagger files to the configuration to be displayed.

Thanks in advance!

Upvotes: 1

Views: 830

Answers (1)

Benjamin Soulier
Benjamin Soulier

Reputation: 2263

By default, SwashBuckle exposes dynamically-generated files out of current Web API project.

To be able to add additional files the easiest way would be to:

Here you can update it to have the default url of your generated file (e.g. swagger/docs/v1) and add your Swagger files, which you end up with a js array simlar to this:

discoveryPaths: arrayFrom('swagger/docs/v1|mySwaggerFiles/swaggerService.json'),

Upvotes: 2

Related Questions