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

How to define controller descriptions in ASP.NET Core Swagger (Swashbuckle.AspNetCore)?

I am trying Swagger in ASP.NET Core WebApi project and everything works fine - except controller descriptions. For instance, I have UredskoPoslovanjeController and description in Swagger UI is UredskoPoslovanje and I can not find a way to change…
mariob
  • 593
  • 1
  • 6
  • 15
11
votes
2 answers

How to use a custom model binder with Swashbuckle, Swagger and NSwag?

I have an ASP.NET Core Web API that contains the following endpoint. [HttpGet] [Route("models/{ids}")] [Produces(typeof(IEnumerable))] public IActionResult Get ( [ModelBinder(typeof(CsvModelBinder))] IEnumerable ids ) { …
Raymond Saltrelli
  • 4,071
  • 2
  • 33
  • 52
11
votes
3 answers

Authorization for JWT bearer in Swashbuckle .NET Core 2

I use tokens generated by an authentication service for my app. No problems there. Now I have introduced Swashbuckle to document my API an I can authenticate as follows by sending the JWT with every request using this code; services.AddSwaggerGen(c…
statler
  • 1,322
  • 2
  • 15
  • 24
11
votes
3 answers

Not able to Inject Javascript in Swagger

I get a 404 for a JavaScript file that I am trying to inject in my swagger. Following is my swagger config var thisAssembly = typeof(SwaggerConfig).Assembly; GlobalConfiguration.Configuration .EnableSwagger(c => { …
coder32
  • 113
  • 1
  • 1
  • 4
11
votes
3 answers

Swashbuckle 5 and multipart/form-data HelpPages

I am stuck trying to get Swashbuckle 5 to generate complete help pages for an ApiController with a Post request using multipart/form-data parameters. The help page for the action comes up in the browser, but there is not included information on the…
Bob
  • 111
  • 1
  • 4
11
votes
2 answers

Leverage MultipleApiVersions in Swagger with attribute versioning

Is it possible to leverage MultipleApiVersions in Swagger UI / Swashbuckle when using attribute routing? Specifically, I implemented versioning by: using System.Web.Http; namespace RESTServices.Controllers.v1 { [Route("api/v1/Test")] public…
Hoppe
  • 6,508
  • 17
  • 60
  • 114
10
votes
1 answer

Swagger/NSwag keep decimal datatype

I do have my .net data classes, containing a few decimal fields (for example quantity). I generate an openapi.json out of it running dotnet swagger. ... "quantity": { "type": "number", "format": "double" }, ... As…
abc
  • 2,285
  • 5
  • 29
  • 64
10
votes
1 answer

Add custom serializer to Swagger in my .Net core API

I'm using the JSONAPI specifications from jsonapi.org, then I'm using the JsonApiSerializer to accomplish the JSONAPI specification, so my response and request body looks like: { "data": { "type": "articles", "id": "stringId", …
HTT
  • 130
  • 1
  • 6
10
votes
6 answers

Exception when adding swagger with .NET Core 3.0

I am trying to integrate swagger into a ASP NET Core 3.0 project and it throws exception right in the ConfigureServices method: I am using Swashbuckle.AspNetCore 4.0.1. I have also checked this issue and also this public void…
Bercovici Adrian
  • 8,794
  • 17
  • 73
  • 152
10
votes
2 answers

Swagger not working (rather exception is thrown) after migrating project from .net core 2.2 to 3.0 preview-7

I have just migrated my project from .net core 2.2 to 3.0 preview 7. I am using Swashbuckle.AspNetCore (v4.0.1) in it. This is my startup class. public class Startup { public IConfiguration Configuration { get; } // This method gets…
10
votes
2 answers

Swashbuckle.AspNetCore required query string parameter

I have an ASP.NET Core v2.1 project with Swashbuckle.AspNetCore package. My code is: /// /// Set new android token for the current driver /// /// /// Sample request: /// /// PUT…
Oleg Sh
  • 8,496
  • 17
  • 89
  • 159
10
votes
3 answers

.NET Core 2.1 Swashbuckle - group controllers by area

My situation is rather simple. I have a very large .NET Core 2.1 MVC/WebApi divided into several Areas, representing different modules of my system. I use Swagger (SwashBuckle) and it works very well. My routing are like…
Casper TL
  • 318
  • 4
  • 7
  • 16
10
votes
2 answers

Issue Using Custom Index.Html in Swagger / Swashbuckle for .NET Core

I am having difficulty using a custom index.html and other assets with swashbuckle. Swashbuckle/Swagger do not seem to recognizing or using them at all. I do have app.UseDefaultFiles() and app.UseStaticFiles() set. I am trying to understand what I…
Anthony Gatlin
  • 4,407
  • 5
  • 37
  • 53
10
votes
2 answers

Add links in description to other operations in Swagger (through Swashbuckle)

According to the documentation for Swashbuckle, only a few XML comments are supported in the latest version. It seems like XML comments such as or are not currently supported but will be implemented in Swashbuckle v6. Until then, is…
Emily Siu
  • 178
  • 2
  • 10
10
votes
1 answer

Change location of swagger JSON using Swashbuckle

I am trying to configure Swashbuckle so the generated JSON file can be accessed using the URL {root}/swagger.json. I've manipulated a number of settings but have been unable to get it to work. Here are some examples: // This works! JSON file is…
SonOfPirate
  • 5,642
  • 3
  • 41
  • 97