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
21
votes
1 answer

How can I make url path in Swashbuckle/Swaggerwork when api is served from inside another project?

all. I am trying to document a WebApi 2 using Swashbuckle package. All works great if the API is running by itself i.e. localhost/api/swagger brings me to ui and localhost/api/swagger/docs/v1 to json. However the producation app initializes this…
Dmitriy
  • 638
  • 1
  • 6
  • 12
20
votes
8 answers

Swashbuckle.AspNetCore: 'No operations defined in spec!' problem after update of 'Microsoft.AspNetCore.Mvc.ApiExplorer' package to 2.2.0

we have .net core 2.1 mvc webapi project which uses Swagger. we use following packages:
20
votes
5 answers

Add `host`, `basePath` and `schemes` to swagger.json using Swashbuckle Aspnetcore

I am using official doc step by step method to configure Swagger UI and generate Swagger JSON file in my ASP.NET core API application. Get started with Swashbuckle and ASP.NET Core If I look at my generated swagger.json file - it is missing three…
Jsinh
  • 2,539
  • 1
  • 19
  • 35
20
votes
3 answers

How to set base path property in swagger for .Net Core Web API

i've built a Web API in ASP.Net Core (version 1.1.2) and i use the Swashbuckle.AspNetCore for generating the swagger definition. below is a part of the automatically generated swagger definition. i would like to change the paths so it does not…
GeertvdC
  • 2,758
  • 1
  • 22
  • 26
20
votes
3 answers

Location of swagger.json when created with Swashbuckle

When I build and run my Azure Web API I get a nice swaggerUI. I want to add the API to Azure API Management. For this I need either a URL or the swagger.json file. Where does Swashbuckle put the file? Or if it generates it on the fly, how can I get…
Richard210363
  • 8,342
  • 6
  • 37
  • 63
20
votes
2 answers

How to show WebApi OAuth token endpoint in Swagger

I've created a new Web Api project, added Asp.Net Identity and configured OAuth like so: OAuthOptions = new OAuthAuthorizationServerOptions { TokenEndpointPath = new PathString("/Token"), Provider = new…
Russ
  • 207
  • 3
  • 6
20
votes
4 answers

Swagger (Swashbuckle) hide header

I use Swashbuckle to add Swagger documentation to my ASP.NET Web API project. How can I hide default header (with swagger logo) from documentation page without injecting CSS?
ranquild
  • 1,799
  • 1
  • 16
  • 25
19
votes
6 answers

Swashbuckle: Make non-nullable properties required

Using Swashbuckle.AspNetCore in an ASP.NET Core webapp, we have response types like: public class DateRange { [JsonConverter(typeof(IsoDateConverter))] public DateTime StartDate {get; set;} [JsonConverter(typeof(IsoDateConverter))] …
crimbo
  • 10,308
  • 8
  • 51
  • 55
18
votes
6 answers

Swagger 'swagger.json' loads, but 404 error on swagger UI '{localhost}/swagger' in AspNet project

Working on setting up swagger for a web application hosted with IIS using AspNetCore. The .json page loads and seems to be touching all the API just fine, however when navigating to {localhost}/swagger to view the UI page I receive a 404 error. I…
Jeremy S.
  • 2,841
  • 4
  • 10
  • 20
18
votes
4 answers

Debugging Swashbuckle Error - Failed to load API Definition

Is there any way to get a stack trace or inner exceptions on Swashbuckle/Swagger errors? At some point, it stopped working. I'm not sure if it was when I upgraded from .Net Core 2.0 to 2.1, but I'm pretty sure it was still working after that. When I…
18
votes
4 answers

Customize generated model names - Swagger UI

I'm trying to adjust the "displayName" of the model being used in an automatically generated Swagger definition. This will only affect the Swagger names, meaning the namespace in code would be left untouched, whilst when looking at the model from…
Hexie
  • 3,955
  • 6
  • 32
  • 55
18
votes
4 answers

Adding Query String Params to my Swagger Specs

I am using Swashbuckle (swagger for C#) with my Web API. I have several GET End-Points that return lists and I allow the user to add a perpage and page params into the QueryString Example: http://myapi.com/endpoint/?page=5&perpage=10 I see that…
Jason H
  • 4,996
  • 6
  • 27
  • 49
17
votes
3 answers

Exclude certain Models from Swashbuckle-generated Swagger Schema in ASP.Net Core OData Project

I am using Swashbuckle to generate the Swagger documentation for my ASP.Net Core 3.1 OData project. The generation of the controllers' methods is perfect. And it is correctly generating the schema based on the models, except for one thing: For each…
Shawn de Wet
  • 5,642
  • 6
  • 57
  • 88
17
votes
5 answers

How do you add a swagger comment to the "Request and Response Model"?

You can add a comment on the methods like the example below but what about adding comments to the request and response model? /// /// my summary /// /// /// remark goes here. /// ///
001
  • 62,807
  • 94
  • 230
  • 350
17
votes
3 answers

Restrict access to certain API controllers in Swagger using Swashbuckle and ASP.NET Identity

So, I started using Swagger. I'm absolutely in love with it's features, but I have some doubts on availability of all methods to public. As far as I understood - all included in Swaschbuclke "auth" methods are actually about APIs itself, but I…