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
14
votes
4 answers

How to change swagger documentation base url?

Everything is working great locally, but I want to change localhost:portNumber with some domain name. So that I may access it from anywhere rather than just consulting my local machine. I didn't find anything helpful in making swagger documentation…
Hasan Badshah
  • 773
  • 1
  • 6
  • 16
14
votes
4 answers

Swagger UI: pass custom Authorization header

I'm using Swashbuckle and Swagger on an ASP.NET Web API. I'm trying to find a way to pass an Authorization header containing a Bearer token through Swagger UI. I've been searching around, but all the answers seem to point at this link. However,…
fikkatra
  • 5,605
  • 4
  • 40
  • 66
14
votes
3 answers

Swashbuckle adding 200 OK response automatically to generated Swagger file

I am building swagger docs using Swashbuckle in my WebApi 2 project. I have the following definition of the method: [HttpPost] [ResponseType(typeof(Reservation))] [Route("reservations")] [SwaggerResponse(HttpStatusCode.Created, Type =…
Václav Holuša
  • 311
  • 3
  • 14
14
votes
5 answers

How to document OData endpoints (swagger, swashbuckle, other)?

What is the best way of documenting OData endpoints? Is there a way to use Swashbuckle for it?
free4ride
  • 1,613
  • 1
  • 18
  • 21
14
votes
1 answer

k__BackingField remove in C# (seen via Swashbuckle / Swagger)

I am using Swashbuckle 5 in my ASP.NET webapi project with all default settings. It serializes my method's output in order to show me schema of the reply. I am getting documentation that looks like this: Response Class (Status 200) Model Model…
onkami
  • 8,791
  • 17
  • 90
  • 176
13
votes
2 answers

How do I change the Swagger default URL and use a custom one?

I have an API that I created in .NetCore 3.1 and have enabled Swagger(OAS3) using Swashbuckle. By default when my app starts if brings up the Swagger page using this URL: http://{port}/swagger.index.html I would like to customize the Swagger URL…
KSS
  • 821
  • 3
  • 10
  • 26
13
votes
3 answers

How to hide a property just in post request description of swagger using swashbuckle?

I am new to ASP.NET Core and this question looks simple but I couldn't find a proper solution online. So here's the problem. This is the structure of the class that I am using. public class Alert { …
13
votes
2 answers

How is the operationId used from an OpenAPI schema?

In an OpenAPI schema, it includes the optional element operationId. How is this used and why is it optional? Well, at least with the .NET Core library "Swashbuckle" they say it's optional. My guess is that it is linked to how an SDK is consumed. For…
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
13
votes
7 answers

Why Swashbuckle.aspnet.core.swagger not being recognized

I've installed though nuget package manager the Swashbuckle.AspNetCore.Swagger and had included the using Swashbuckle.AspNetCore.Swagger on the top, but I get error on the Info{ Title} methods. Can anyone please suggest how to solve this issue. …
user10489212
13
votes
1 answer

How can I hide response code 200 with Swashbuckle.AspNetCore?

Ciao, I'm working on a asp.net web api core (target framework .NET Core 2.1). I'm documenting my API using Swagger specifications. I chose to use Swashbuckle.AspNetCore library. I have one simple create action like the following: ///
ilMattion
  • 1,841
  • 2
  • 24
  • 47
13
votes
3 answers

Integrate swashbuckle swagger with odata in ASP.Net Core

I have tried to implement both ( swagger and odata ) in asp.net core, but it's not working. I'm unable to integrate the route given for odata. I have the following Configuration and I receive a generic error. This is the error
Ayushi Sharma
  • 155
  • 1
  • 1
  • 4
13
votes
2 answers

Swagger/Swashbuckle Authorize. Scopes checked by default

Is it possible to set an auth scope checkbox checked by default on Swashbuckle UI on a asp.net Core 2.0 Web API?? I use the "openid" scope and I'd like to have it checked every time. Thank you.
Toni
  • 173
  • 8
13
votes
2 answers

How to include class and property descriptions in Swashbuckle generated Swagger docs for WebApi 2 with OWIN?

Before you think of it, this is not the same. I think this should be pretty much self explanatory. I would like to include class descriptions in the Swagger docs. My Swagger config looks like this: config.EnableSwagger(c => { …
Marcus
  • 8,230
  • 11
  • 61
  • 88
13
votes
1 answer

How to configure Swagger/Swashbuckle custom serializer IControllerConfiguration ASP.NET WebAPI

I have a WebAPI endpoint that implements two different versions of the API (legacy and new). The legacy endpoints use a specific Serializer that has all objects serialized as lower case words with underscores, the v2 endpoint uses camel cased…
Kris
  • 131
  • 1
  • 5
13
votes
2 answers

Enable Oauth2 client credentials flow in Swashbuckle

Im using IdentityServer3 to secure a Web API with the client credentials grant. For documentation Im using Swashbuckle but can't figure out how to enable Oauth2 in the SwaggerConfig for the client credentials (application) flow. Any help would be…
mstrand
  • 2,973
  • 5
  • 24
  • 26