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
242
votes
31 answers

Swagger UI Web Api documentation Present enums as strings?

Is there a way to display all enums as their string value in swagger instead of their int value? I want to be able to submit POST actions and put enums according to their string value without having to look at the enum every time. I tried…
user5326354
172
votes
28 answers

500 Error when setting up Swagger in asp .net CORE / MVC 6 app

I'm trying to setup a basic swagger API doc in a new asp .net CORE / MVC 6 project and receiving a 500 error from the swagger UI: 500 : http://localhost:4405/swagger/v1/swagger.json My startup class has the following code in it: using…
dr b
  • 1,929
  • 2
  • 10
  • 14
127
votes
36 answers

Swashbuckle/Swagger + ASP.Net Core: "Failed to load API definition"

I develop an ASP.NET Core 2 application and included Swagger. Everything worked fine until I introduced a method without explicitly defining the HTTP action: public class ErrorController : Controller { [Route("/error")] public IActionResult…
Ash
  • 3,283
  • 6
  • 16
  • 20
112
votes
38 answers

ASP.NET Core - Swashbuckle not creating swagger.json file

I am having trouble getting the Swashbuckle.AspNetCore (1.0.0) package to generate any output. I read the swagger.json file should be written to '~/swagger/docs/v1'. However, I am not getting any output. I started with a brand new ASP.NET Core API…
John Livermore
  • 30,235
  • 44
  • 126
  • 216
108
votes
7 answers

swagger error: Conflicting schemaIds: Duplicate schemaIds detected for types A and B

Using Web API and using swashbuckle to generate swagger documentation, I defined two different classes with the same name in two different namespaces. when I open swagger page in my browser it says Conflicting schemaIds: Duplicate schemaIds…
Mahdi Ataollahi
  • 4,544
  • 4
  • 30
  • 38
104
votes
33 answers

Swagger not loading - Failed to load API definition: Fetch error undefined

Trying to setup swagger in conjunction with a web application hosted on IIS express. API is built using ASP Net Core. I have followed the instructions prescribed on the relevant microsoft help page regarding Swashbuckle and ASP.NET Core. Thus far I…
Jeremy S.
  • 2,841
  • 4
  • 10
  • 20
97
votes
4 answers

Bearer authentication in Swagger UI, when migrating to Swashbuckle.AspNetCore version 5

I'm trying to migrate from version 4.0.1 to 5.0.0-rc2 of Swashbuckle in a .NET Core 3 Preview 5 Web API project. I've got the project compiling and the Swagger UI working, but I can't get Bearer authentication to work, which I think is due to me not…
tomRedox
  • 28,092
  • 24
  • 117
  • 154
95
votes
21 answers

How to configure Swashbuckle to ignore property on model

I'm using Swashbuckle to generate swagger documentation\UI for a webapi2 project. Our models are shared with some legacy interfaces so there are a couple of properties I want to ignore on the models. I can't use JsonIgnore attribute because the…
mutex
  • 7,536
  • 8
  • 45
  • 66
91
votes
6 answers

swagger-ui returns 500 after deployment

Out of the box configuration works perfectly on my machine, no problems at all. But when I deploy to our test environment - I get the following message 500 : { "Message": "An error has occurred." } /api/swagger/docs/v1 The deployment is to…
VisualBean
  • 4,908
  • 2
  • 28
  • 57
80
votes
6 answers

Can't read from file issue in Swagger UI

I have incorporated swagger-ui in my application. When I try and see the swagger-ui I get the documentation of the API nicely but after some time it shows some error icon at the button. The Error message is like…
Abi P
  • 1,410
  • 3
  • 22
  • 36
69
votes
6 answers

How to add method description in Swagger UI in WebAPI Application

I am using Swagger as my API tooling framework and it is working out great so far. I just came across this page https://petstore.swagger.io/ and saw how each method has a description. For example, POST: pet/ is described by add a new Pet to the…
Lost
  • 12,007
  • 32
  • 121
  • 193
66
votes
7 answers

JWT Authentication and Swagger with .NET Core 3.0

I am developing some Web API with .NET Core 3.0 and want to integrate it with SwashBuckle.Swagger. It is working fine, but when I add JWT authentication, it does not work as I expect. To do that, I added the code below: services.AddSwaggerGen(c => …
Nick Mehrdad Babaki
  • 11,560
  • 15
  • 45
  • 70
63
votes
9 answers

swagger .net core API ambiguous HTTP method for Action Error

Implementing Swashbuckle/Swagger with .net Core 2 API I am now receiving the 500 error when accessing swagger.json: NotSupportedException: Ambiguous HTTP method for action - EBisAPI.Controllers._class.HandleError (EBisAPI). Actions require an …
sammarcow
  • 2,736
  • 2
  • 28
  • 56
58
votes
1 answer

What is Swagger, Swashbuckle and Swashbuckle UI

This is my understanding: Swagger is a notation/rules to write documentation. But why is it called a framework (like Angular/MVC)? Swashbuckle is a program (JavaScript?) that generates the documentation (based on Swagger rules). Swagger UI…
Blue Clouds
  • 7,295
  • 4
  • 71
  • 112
56
votes
1 answer

What is Swagger and does it relate to OData?

I am familiar with the Microsoft stack. I am using OData for some of my restful services. Recently I came across Swagger for API documentation and I am trying to understand how it relates to OData. Both of them seem to be RESTful specifications.…
Muthukumar
  • 8,679
  • 17
  • 61
  • 86
1
2 3
90 91