Questions tagged [swashbuckle]

Swashbuckle is an open source framework which adds Swagger and Swagger-ui to ASP.NET Web API projects.

Swashbuckle combines ApiExplorer, Swagger and Swagger-ui to provide a rich discovery, documentation and playground experience to your ASP.NET Web API consumers.

Core features:

  • Auto-generated Swagger 2.0
  • Seamless integration of swagger-ui
  • Reflection-based Schema generation for describing API types
  • Extensibility hooks for customizing the generated Swagger doc
  • Extensibility hooks for customizing the swagger-ui
  • Out-of-the-box support for leveraging Xml comments
  • Support for describing ApiKey, Basic Auth and OAuth2 schemes ... including UI support for the Implicit OAuth2 flow

The Swashbuckle tag should be used for questions about:

  • Configuring Swashbuckle
  • Extending Swashbuckle with the interfaces ISchemaFilter, IOperationFilter and IDocumentFilter
  • Customizing the embedded Swagger-UI

Questions specifically addressing Swagger or Swagger-UI should not be tagged with the Swashbuckle tag.

Source code: https://github.com/domaindrivendev/Swashbuckle

1366 questions
25
votes
2 answers

Swashbuckle.AspNetCore SwaggerOperation attribute not found

I am trying to use Autorest and Swagger documentation created by the help of Swashbuckle.AspNetCore (3.0.0) in order to generate a REST API client. The swagger documentation generated seems to be correct except that the operation name are not really…
Sébastien Krejci
  • 431
  • 1
  • 4
  • 9
25
votes
2 answers

Manually set operationId to allow multiple operations with the same verb in Swashbuckle

I need to know if it's possible to set up custom operationid, or a naming convention, I mean I know that operation filter can be overwritten the way how operationId is…
24
votes
6 answers

Swagger UI not displaying when deploying API on IIS

Well, I'm using Swagger for my API documentation and it works perfectly in localhost, the problem begins when I host it on the IIS. For somereason it just doesn't work…
Pedro Leal
  • 439
  • 1
  • 4
  • 9
23
votes
3 answers

Mark strings as non-nullable in ASP.NET Core 3.0 Swagger

I'm using ASP.NET Core 3 and Swashbuckle with mostly default configuration and I have a DTO parameter with a string on it that I want to be non-nullable. How can I achieve this? Note, Required and nullability are separate concerns in Swagger. It's…
Quails4Eva
  • 431
  • 1
  • 5
  • 12
23
votes
1 answer

How do I set "Parameter content type" using Swashbuckle?

My swagger ui shows "Parameter content type" with various entries: "application/json-patch+json", "text/json", "application/json", and "application/*+json". I only want "application/json". There's a similar unsolved issue on the repo, which uses…
lonix
  • 14,255
  • 23
  • 85
  • 176
23
votes
2 answers

Secure swagger docs page with username and password Asp Net Core 2.1

I am using Asp.Net Core 2.1 Web Api with Swashbuckle.aspnetcore.swagger I want to secure api documentation page with username and password before granting access. Sample documention page To make sure its not accessible by the public
Joshua Leigh
  • 340
  • 1
  • 3
  • 8
23
votes
6 answers

Show only selected controllers in swagger-swashbuckle UI

I am currently using swagger in my project and i have more than 100 controllers there. I guess due to the large number of controller, swagger UI documentation page takes more than 5 min to load its controller. Is it possible to select specific…
Subash Kharel
  • 478
  • 1
  • 3
  • 12
23
votes
3 answers

API key in header with swashbuckle

I want to do API key based authentication on a WebAPI project with Swashbuckle (swagger for .net). I have configured swashbuckle as below: config .EnableSwagger(c => { c.ApiKey("apiKey") .Description("API Key…
undefined
  • 33,537
  • 22
  • 129
  • 198
22
votes
7 answers

Asp.Net core Swashbuckle set operationId

How can I set swagger operationId attribute in Asp.Net Core 2.1 project? According to this post I should use SwaggerOperationAttribute but I cannot find it in Swashbuckle.AspNetCore library. Also there is an IOperationFilter public interface…
22
votes
9 answers

How to redirect from root url to /swagger/ui/index?

I have a WebApi project with Swashbuckle installed onto it. In default setup, I must open in browser http://localhost:56131/swagger/ui/index to view my operations description and test page. I want it to be accessible from root of the site:…
v.karbovnichy
  • 3,183
  • 2
  • 36
  • 47
22
votes
1 answer

Data annotations in Swagger

I am using ASP.NET and Swagger that exposes a complex type that accepts a POST. It has a number of string fields that have different restricted lengths. How can I reflect that in the Swagger UI?
illug
  • 793
  • 1
  • 9
  • 23
22
votes
4 answers

Swashbuckle Swagger - How to annotate content types?

How do I annotate my ASP.NET WebAPI actions so that the swagger metadata includes the content-types that my resources support? Specifically, I want the documentation to show that one of my resources can return the 'original' application/json and…
Luke Puplett
  • 42,091
  • 47
  • 181
  • 266
22
votes
4 answers

How to send Authorization header with a request in Swagger UI?

I have a ASP.NET Web Api 2 application. I added Swashbuckle to it (Swagger for .NET). It displays my endpoints no problem, but in order to send a request I need to attach an Authorization header to that request. If I understand correctly in order to…
Marta
  • 1,132
  • 1
  • 10
  • 26
21
votes
2 answers

Using Swashbuckle 5.x specify nullable = true on a Generic T Parameter reference property

I recently upgraded my API to a .net core 3.1 server using Swashbuckle 5 with the newtonsoft json nuget, which produces an openapi 3 schema. I then use NSwag to generate a C# API. Previously I had a .net core 2.2 server with swashbuckle 4, producing…
Adam Diament
  • 4,290
  • 3
  • 34
  • 55
21
votes
5 answers

What is causing the error that swagger is already in the route collection for Web API 2?

I installed Swagger in my ASP.Net MVC Core project and it is documenting my API beautifully. My co-worker asked me to install it in a full framework 4.6.1 project so I've done the following. In Package Console Manager run: Install-Package…
Sam
  • 4,766
  • 11
  • 50
  • 76
1 2
3
90 91