swashbuckle

How to configure Swashbuckle to ignore property on model for a specific api version only

守給你的承諾、 提交于 2021-02-11 14:39:48
问题 I needed to add a property to a model and I have implemented what is suggested in the selected answer here and it's working in that it removes the property I have tagged with SwaggerIgnorePropertyAttribute attribute of the model. My question is , if I have several API versions of my application,how to remove it from the swagger doc/schema for certain versions? I only care not to see the added property in swagger. I only really have 1 version of the model across the application even though I

Aspnet core 2.2 default route changed to “~/index.html” after installing Swashbuckle.AspNetCore package

ぃ、小莉子 提交于 2021-02-11 09:39:39
问题 After installing the Swashbuckle.AspNetCore in my Asp.net Core (MVC) application the default route is override with "index.html" page. Where ever I used "~/" now is redirecting my application to "~/index.html" instead of default MVC route. How i can fix this? 回答1: I had encountered this issue after setting the route prefix of swagger to root i.e. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "LMW Valuer API V1"); c.RoutePrefix = string.Empty; }); Even after removing

.NET Core Web Api Azure AD and Swagger not authenticating

大憨熊 提交于 2021-02-11 06:21:15
问题 I am trying to set up a .NET Core Web API with Azure AD authentication and Swagger but it gives an error when trying to authenticate. I am following this guide: http://www.sharepointconfig.com/2018/08/configure-swagger-to-authenticate-against-azure-ad/ ConfigureServices contains this code: services.AddSwaggerGen(c => { c.AddSecurityDefinition("oauth2", //Name the security scheme new OpenApiSecurityScheme { Type = SecuritySchemeType.OAuth2, Flows = new OpenApiOAuthFlows() { Implicit = new

How to add a Schema Filter to just one Swashbuckle api document version

▼魔方 西西 提交于 2021-02-10 18:43:07
问题 I have an issue, I use Swashbuckle 4 and it doesn't support polymorph, I found two filters that do that. One DocumentFilter and one SchemaFilter. They work like charme. But now I have an issue, I add a second version to my api. But I have a polymorph model which is just supported by version 2. But I found no way to add these filters just to one api version, because they are added at Startup to the SwaggerGenOptions. I'm little bit shocked that Swashbuckle does not seem to support Filters per

How to add a Schema Filter to just one Swashbuckle api document version

陌路散爱 提交于 2021-02-10 18:35:36
问题 I have an issue, I use Swashbuckle 4 and it doesn't support polymorph, I found two filters that do that. One DocumentFilter and one SchemaFilter. They work like charme. But now I have an issue, I add a second version to my api. But I have a polymorph model which is just supported by version 2. But I found no way to add these filters just to one api version, because they are added at Startup to the SwaggerGenOptions. I'm little bit shocked that Swashbuckle does not seem to support Filters per

How do I set or remove the Default Response Content Type Using SwashBuckle

被刻印的时光 ゝ 提交于 2021-02-10 12:56:57
问题 The default response content type when using SwashBuckle is text/plain . How can I change the default to be application/json or even remove text/plain ? 回答1: The response content of an end point is not determined by Swashbuckle but by the formatters set in the configuration of your ASP.NET Web API project. To remove the text/plain content type and only support application\json you could add this to the Register method of your WebApiConfig : GlobalConfiguration.Configuration.Formatters.Clear()

How do I set or remove the Default Response Content Type Using SwashBuckle

ε祈祈猫儿з 提交于 2021-02-10 12:56:15
问题 The default response content type when using SwashBuckle is text/plain . How can I change the default to be application/json or even remove text/plain ? 回答1: The response content of an end point is not determined by Swashbuckle but by the formatters set in the configuration of your ASP.NET Web API project. To remove the text/plain content type and only support application\json you could add this to the Register method of your WebApiConfig : GlobalConfiguration.Configuration.Formatters.Clear()

.NET Core 2.1 Swashbuckle - group controllers by area

拜拜、爱过 提交于 2021-02-09 20:32:28
问题 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 {area}/{controller}/{action} . In Swagger UI, every action is grouped into the controllers (standard behaviour). My list of controllers and operations is becoming very very large and hard to grasp. Because of that, i would love if Swagger could divide my controllers into the

.NET Core 2.1 Swashbuckle - group controllers by area

自作多情 提交于 2021-02-09 20:30:54
问题 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 {area}/{controller}/{action} . In Swagger UI, every action is grouped into the controllers (standard behaviour). My list of controllers and operations is becoming very very large and hard to grasp. Because of that, i would love if Swagger could divide my controllers into the

.NET Core 2.1 Swashbuckle - group controllers by area

不问归期 提交于 2021-02-09 20:30:12
问题 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 {area}/{controller}/{action} . In Swagger UI, every action is grouped into the controllers (standard behaviour). My list of controllers and operations is becoming very very large and hard to grasp. Because of that, i would love if Swagger could divide my controllers into the