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
53
votes
3 answers

What is AddEndpointsApiExplorer in ASP.NET Core 6

I'm upgrading an ASP.NET Core API project from v5 to v6. Service config in v5: services.AddSwaggerGen(); Service config in v6: builder.Services.AddEndpointsApiExplorer(); // what is this? builder.Services.AddSwaggerGen(); What is…
lonix
  • 14,255
  • 23
  • 85
  • 176
50
votes
4 answers

Enable bearer token in Swashbuckle (Swagger document)

I created an asp.net webapi application which is using Individual Account Security so that the Bearer token is enabled by default. It's working fine so that I am able to test them in Postman without problem. Here comes the question when I'm trying…
Bagusflyer
  • 12,675
  • 21
  • 96
  • 179
49
votes
4 answers

How do I generate API documentation for SignalR

Is there a way to do this? I have swashbuckle generating content for my other APIs but I don't believe it works for SignalR.
LivingOnACloud
  • 1,151
  • 1
  • 11
  • 20
46
votes
6 answers

Is there a way change the Controller's name in the swagger-ui page?

I'm using Swashbuckle to enable the use of swagger and swagger-ui in my WebApi project. In the following image you can see two of my controllers shown in the swagger-ui page. These are named as they are in the C# code, however I was wondering if…
XN16
  • 5,679
  • 15
  • 48
  • 72
41
votes
9 answers

Not supported by Swagger 2.0: Multiple operations with path

I have integrated swagger in WebApi 2 application. It works fine when application has single controller. When I added second controller in the application. I got following error : An error has occurred.","ExceptionMessage":"Not supported by…
39
votes
8 answers

How to set up Swashbuckle vs Microsoft.AspNetCore.Mvc.Versioning

We have asp.net core webapi. We added Microsoft.AspNetCore.Mvc.Versioning and Swashbuckle to have swagger UI. We specified controllers as this: [ApiVersion("1.0")] [Route("api/v{version:apiVersion}/[controller]")] public class ContactController :…
Alezis
  • 2,659
  • 3
  • 27
  • 34
37
votes
3 answers

How to make Swagger show examples of objects returned from the API?

I am creating a set of API's for the first time. Here's one of the methods: // GET: api/Doors/0 /// /// Get a list of all doors for a given organization. /// /// The…
Casey Crookston
  • 13,016
  • 24
  • 107
  • 193
35
votes
1 answer

NSwag vs Swashbuckle

I've read in the documentation that "The two main OpenAPI implementations for .NET are Swashbuckle and NSwag" but what are the differences between them?
Stanislav
  • 4,389
  • 2
  • 33
  • 35
34
votes
11 answers

Swashbuckle 5 can't find my ApiControllers

I'm at a point where I really need API documentation for my WebAPI 2 project, and I used the Swashbuckle 5 NuGet package. Out of the box, I can hit {myrooturl}/swagger and a UI pops up, but there are no controllers, methods, or anything in there.…
Bill Sambrone
  • 4,334
  • 4
  • 48
  • 70
30
votes
4 answers

Grouping of API methods in documentation - is there some custom attribute

I have controller like public class UserController : ApiController { [Route("api/user")] IHttpActionResult GetUser() { ... } } public class ResumeController : ApiController { [Route("api/user/resumes")] IHttpActionResult GetResumes() { ...…
Ondrej Svejdar
  • 21,349
  • 5
  • 54
  • 89
29
votes
4 answers

Swashbuckle parameter descriptions

I'm using SwaggerResponse attributes to decorate my api controller actions, this all works fine, however when I look at the generated documentation the description field for parameters is empty. Is a there an attribute based approach to describe…
Slicc
  • 3,217
  • 7
  • 35
  • 70
28
votes
1 answer

Change property type as exported by Swagger/Swashbuckle

I have a fairly complex object with nested objects; please note that in the example below I have simplified this object greatly. Assume the following example object: public class Result { public string Name { get; set; } public IpAddress…
RobIII
  • 8,488
  • 2
  • 43
  • 93
27
votes
3 answers

Should you Combine Swagger with HATEOAS/HAL/JSON-LD?

I am using Swagger for my ASP.NET Core API using Swashbuckle which describes my API in a separate document and provides a nice UI for all of this information. Are there any advantages of using something like HATEOAS, HAL or JSON-LD which modify the…
Muhammad Rehan Saeed
  • 35,627
  • 39
  • 202
  • 311
26
votes
5 answers

Using Swashbuckle for Asp.net core how can I add a model to the generated model list?

I'm using Swashbuckle with ASP.net core. It is producing a nice website with a list of models at the bottom. How can I add a model to this list that isn't already appearing? I return an abstract class in one of my requests and I want to list all…
chris31389
  • 8,414
  • 7
  • 55
  • 66
26
votes
5 answers

Swagger default value for parameter

How do I define default value for property in swagger generated from following API? public class SearchQuery { public string OrderBy { get; set; } [DefaultValue(OrderDirection.Descending)] public OrderDirection…
Liero
  • 25,216
  • 29
  • 151
  • 297
1
2
3
90 91