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

Swashbuckle rename Data Type in Model

I'm putting together a web API that needs to match an external sources XML format and was looking to rename the Data Type objects in the swagger output. It's working fine on the members of the class but I was wondering if it was possible to…
weretaco
  • 135
  • 1
  • 7
9
votes
2 answers

Alter parameter name for Swagger JSON generated through Swashbuckle in .NET Web API 2

Goal: I am designing a REST API that allows user to pass parameters on the query string for an HTTP GET request. Something like http://fake.api.com/search?api-key=1235&term=car&rows=10 Implementation: on the server-side I have a model binder that…
codelove
  • 1,396
  • 3
  • 17
  • 35
8
votes
2 answers

Swashbuckle using port 80 for https when run behind reverse proxy

I have a .net core api documented with swagger/swashbuckle. When running the swagger ui on localhost on url https://localhost:44390/ the "Try it out" works fine. We have the same solution in an App service in Azure with an Azure Front Door acting as…
8
votes
2 answers

Generate Swagger OpenApi Spec 3.0 using Swashbuckle in Asp.Net Framework WebApi

Swashbuckle version="5.6.0" targetFramework="net451" generates "swagger": "2.0" spec.Is there any way to generate 3.0 spec? In Asp.Net Core we can generate 3.0, what about in Asp.Net Framework WebApi?
abdulbasit
  • 1,856
  • 15
  • 17
8
votes
7 answers

Swagger - hide api version parameters

Is it possible to hide the 'api-version' and 'x-api-version' parameters? services.AddApiVersioning(config => { config.ReportApiVersions = true; config.DefaultApiVersion = new ApiVersion(1, 0); …
Odrai
  • 2,163
  • 2
  • 31
  • 62
8
votes
2 answers

Mark a WebApi method's parameter as obsolete / deprecated for Swashbuckle / Swagger

As per my understanding of the Swagger Specification, it's possible to mark a parameter as obsolete: Deprecated Parameters Use deprecated: true to mark a parameter as deprecated. - in: query name: format required: true …
Jonathan L.
  • 682
  • 6
  • 10
8
votes
1 answer

Is there equivalent

I updated Swashbuckle v5 and operation.Parameters() is not valid anymore.Is there any replacement? { var apiDescription = context.ApiDescription; operation.Deprecated |= apiDescription.IsDeprecated(); if…
Yoana Gancheva
  • 529
  • 1
  • 5
  • 10
8
votes
0 answers

Request response object and content type annotation convention

I am using asp.net core 2.2.6, I am not clear what the expected convention is regarding the use of ProducesAttribute and ProducesResponseTypeAttribute annotations with ProblemDetails. Without the annotations, an API behaves as expected and the…
Ritmo2k
  • 993
  • 6
  • 17
8
votes
4 answers

cannot convert from 'Microsoft.OpenApi.Models.OpenApiInfo' to 'Swashbuckle.AspNetCore.Swagger.Info'

I'm getting this error when tryign to run swashbuckle. Any ideas? I have this in my ConfigureServices Class services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "testing", …
stevo
  • 108
  • 1
  • 1
  • 3
8
votes
0 answers

Swashbuckle with OData Controller

I am using: ASP.NET Core 2.1 OData Swashbuckle.AspNetCore (3.0.0) And I am trying to use swashbuckle for odata and when I add the value controller I get this error: And if I remove the value controller, I would get this on swagger: public void…
Raniel Quirante
  • 431
  • 2
  • 12
8
votes
1 answer

Swashbuckle OAuth2 Authorization with Client Credentials Flow

I use Swashbuckle to documentation of WebAPI controllers. Also I use OAuth2 with Client Credentials Flow. So to authorize I need to pass client_id and client_secret. I have following code: config.EnableSwagger(c => { c.SingleApiVersion("v1",…
Robert N. Dean
  • 1,219
  • 1
  • 14
  • 27
8
votes
4 answers

How to specify https scheme in Swashbuckle for .NET Core

How can I specify https schema in the .NET Core version of Swashbuckle? In ASP.NET version I could do .EnableSwagger(c => { c.Schemes(new[] { "https" }); } but I don't see anything similar as part of AddSwaggerGen.
SiberianGuy
  • 24,674
  • 56
  • 152
  • 266
8
votes
1 answer

Swagger cross out method

I am using Swaschbuckle for my .NET Swagger Web API Service. I have looked at the sample from http://petstore.swagger.io/#/pet and there ist the Action findByTags which is crossed out. I want to cross out an action in my api service, but when i am…
Sebastian
  • 131
  • 1
  • 6
8
votes
1 answer

Get XML comments output file location for ASP Core

I've added Swashbucklepackage to my ASP Core project. I'd like to configure Swagger to use auto-generated by VS xml comments. The problem is that I can't find the way to get that location: PlatformServices.Default.Application.ApplicationBasePath -…
dr11
  • 5,166
  • 11
  • 35
  • 77
8
votes
8 answers

Swagger UI freezes after API fetch and browser crashes

I have an ASP.NET WebAPI project where I am attempting to replace our old XmlDocumentationProvider page with Swagger UI. I am using the swashbuckle swagger for webAPI 5.3.1 nuget package. I am able to navigate to localhost/MyApp/swagger, and I can…
jbabey
  • 45,965
  • 12
  • 71
  • 94