swashbuckle

.NET Core 2.1 Swashbuckle - group controllers by area

天大地大妈咪最大 提交于 2021-02-09 20:29:51
问题 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

Mark strings as non-nullable in ASP.NET Core 3.0 Swagger

微笑、不失礼 提交于 2021-02-07 13:14:51
问题 I'm using ASP.NET Core 3 and Swashbuckle with mostly default configuration and I have a DTO parameter with a string on it that I want to be non-nullable. How can I achieve this? Note, Required and nullability are separate concerns in Swagger. It's also using C#8 and the non-nullable stuff, so the compiler should be annotating the property as non-nullable already. It's understandable that Swashbuckle hasn't been updated to take that into account (and maybe can't) but I would like to be able to

list the api in swagger based on user roles

泪湿孤枕 提交于 2021-02-05 11:47:29
问题 I have a requirement where I want to list the api methods in swagger based on user roles. For example :- User A with basic access can use limited api methods. User B with Admin access can use all the listed api methods. I don't know how to achieve this. I am using Swashbuckle.AspNetCore Version="1.0.0" 回答1: Try using an IDocumentFilter, you can limit what the user gets in the SwaggerDocument and the swagger-ui feeds from that. Here are some examples https://github.com/heldersepu

list the api in swagger based on user roles

瘦欲@ 提交于 2021-02-05 11:45:30
问题 I have a requirement where I want to list the api methods in swagger based on user roles. For example :- User A with basic access can use limited api methods. User B with Admin access can use all the listed api methods. I don't know how to achieve this. I am using Swashbuckle.AspNetCore Version="1.0.0" 回答1: Try using an IDocumentFilter, you can limit what the user gets in the SwaggerDocument and the swagger-ui feeds from that. Here are some examples https://github.com/heldersepu

How to mark api parameter as optional for Swagger UI for Web API 2?

℡╲_俬逩灬. 提交于 2021-01-29 03:30:29
问题 I am using Swagger for WebApi 5.5.3 nuget package for API documentation. In swagger UI it is showing required option for optional parameter. I tried XML comment option in Visual studio. Below is the API method that i want to document: /// <summary> /// Gets the history. /// </summary> /// <param name="currentPageIndex">Index of the current page.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="lastSyncDate">The last synchronize date.</param> /// <returns></returns

Swagger sort Schema Definitions

流过昼夜 提交于 2021-01-28 07:25:49
问题 It is not possible to create subgroups in the Swagger documentation. Further, there is no possibility to sort the models (A, B). For the operations, it is possible to work around it using tags. Is there a similar solution for the Data Definitions? (We are using Swashbuckle to create an HTML description.) 来源: https://stackoverflow.com/questions/57057487/swagger-sort-schema-definitions

Swagger sort Schema Definitions

牧云@^-^@ 提交于 2021-01-28 06:51:14
问题 It is not possible to create subgroups in the Swagger documentation. Further, there is no possibility to sort the models (A, B). For the operations, it is possible to work around it using tags. Is there a similar solution for the Data Definitions? (We are using Swashbuckle to create an HTML description.) 来源: https://stackoverflow.com/questions/57057487/swagger-sort-schema-definitions

Swashbuckle 5 and multipart/form-data HelpPages

三世轮回 提交于 2021-01-26 04:00:49
问题 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 parameters passed in the form. I have created an operation filter and enabled it in SwaggerConfig, the web page that includes the URI parameters, return type and other info derived from XML comments shows in the browser help pages; however, nothing

Swashbuckle 5 and multipart/form-data HelpPages

孤街醉人 提交于 2021-01-26 04:00:47
问题 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 parameters passed in the form. I have created an operation filter and enabled it in SwaggerConfig, the web page that includes the URI parameters, return type and other info derived from XML comments shows in the browser help pages; however, nothing

Can't read from file issue in Swagger UI

安稳与你 提交于 2021-01-20 14:50:24
问题 I have incorporated swagger UI in my application. When I try and see the swagger UI, I get the documentation of the API nicely but after some time it shows some error icon at the button. The Error message is like below: [{"level":"error","message":"Can't read from file http://MYIP/swagger/docs/v1"}] I am not sure what is causing it. If I refresh it works and shows error after few seconds. 回答1: I am guessing "http://MYIP/swagger/docs/v1" is not publicly accessible. By default swagger ui uses