swashbuckle

Listing API Methods Under Multiple Groups

扶醉桌前 提交于 2020-01-01 18:17:21
问题 I have Swashbuckle annotated code that looks like this: [Route("api/Subscribers/{id}/[controller]")] [Route("api/Organizations/{id}/[controller]")] public class AddressesController : Controller { [HttpGet("{aid}")] [SwaggerResponse(HttpStatusCode.OK, Type = typeof(PostalRecord))] public async Task<IActionResult> GetAddress(Guid id, Guid aid) { //do something } I would like to use the GroupActionsBy customization, as shown in this example, but I want to have the above GetAddress method

Empty authorization header on requests for Swashbuckle.AspNetCore

一笑奈何 提交于 2019-12-31 06:29:33
问题 Currently having an issue with authorization headers in swashbuckle for .net core The first line of code on every endpoint is: string auth = Request.Headers["Authorization"]; When using postman, everything works smoothly, but when making a request from localhost/swagger, the header is empty when a breakpoint is inserted, the header is a null value. the body of the request is in tact and everything works properly when the authorization is removed from the endpoint In my services.AddSwaggerGen

Empty authorization header on requests for Swashbuckle.AspNetCore

感情迁移 提交于 2019-12-31 06:29:04
问题 Currently having an issue with authorization headers in swashbuckle for .net core The first line of code on every endpoint is: string auth = Request.Headers["Authorization"]; When using postman, everything works smoothly, but when making a request from localhost/swagger, the header is empty when a breakpoint is inserted, the header is a null value. the body of the request is in tact and everything works properly when the authorization is removed from the endpoint In my services.AddSwaggerGen

Auth error invalid_scope“,”error_description“:”Custom+scopes+are+not+allowed+for+this+request. OKTA Asp.net core Swagger

冷暖自知 提交于 2019-12-25 00:09:23
问题 I am trying to setup the swagger authentication to the OKTA. But getting the error as invalid_scope","error_description":"Custom+scopes+are+not+allowed+for+this+request. Not sure how to resolve this issue. Here is my setup code public const string ResourceIdentifier = "id-gateway-api"; public void Configure(SwaggerGenOptions options) { foreach (var description in provider.ApiVersionDescriptions) { options.SwaggerDoc(description.GroupName, CreateInfoForApiVersion(description)); } options

MapHttpRoute and Swagger

久未见 提交于 2019-12-24 17:19:47
问题 I'm trying to limit what shows up on swagger by limiting the routes available. Here are my current routes: config.Routes.MapHttpRoute( name: "SiteCache", routeTemplate: "{controller}/{id}/{action}", defaults: new { controller = "Sites", action ="Cache" }, constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Delete), controller = "Sites" } ); config.Routes.MapHttpRoute( name: "SitePost", routeTemplate: "{controller}", defaults: new { controller = "Sites", action ="Post" },

ASP.NET Web API Swagger (Swashbuckle) Duplicate OperationId

a 夏天 提交于 2019-12-24 07:45:41
问题 I have a web api controller like below. In swagger output I am having the below image And when I want to consume it in my another console app, it is showing the below error Note I have followed the tutorial Customize Swashbuckle-generated API definitions but still getting the same error. Any idea? 回答1: I must need to add the Route Attribute on top of the Action methods. Like below: So, the API changed into below Swagger UI endpoints And when I consumed this Swagger in my console app, the

Swagger UI nested expandable groupings

瘦欲@ 提交于 2019-12-24 06:34:48
问题 I am using SwaggerUI for documenting API endpoints. Currently they are grouped by controller name, in one long list. You can then expand each controller to view the operations. Everything standard. What I would like to do, is group the controllers under common expandable groups. So for example, you have a Pet group, which can be expanded, to reveal Cat and Dog controllers, which can then in turn be expanded to show their respective operations. I have tried using Tags to accomplish this, but

ASP.Net Web API Swashbuckle how to ignore HttpRequestMessage

▼魔方 西西 提交于 2019-12-24 04:06:08
问题 I'm using Swashbuckle to generate docs for an API. My controller methods looks like this: [ResponseType(typeof(CategoryCollectionModel))] public HttpResponseMessage Get(HttpRequestMessage request, [FromUri]Paging paging) { var input = new CategoriesListQuery.Input { Page = paging.Page, Size = paging.Size }; var result = this.queryInvoker.Execute<CategoriesListQuery.Input, CategoriesListQuery.Result>(input); var items = Mapper.Map<CategoryCollectionModel>(result); return request.CreateResponse

ASP.Net Web API Swashbuckle how to ignore HttpRequestMessage

喜你入骨 提交于 2019-12-24 04:06:04
问题 I'm using Swashbuckle to generate docs for an API. My controller methods looks like this: [ResponseType(typeof(CategoryCollectionModel))] public HttpResponseMessage Get(HttpRequestMessage request, [FromUri]Paging paging) { var input = new CategoriesListQuery.Input { Page = paging.Page, Size = paging.Size }; var result = this.queryInvoker.Execute<CategoriesListQuery.Input, CategoriesListQuery.Result>(input); var items = Mapper.Map<CategoryCollectionModel>(result); return request.CreateResponse

Override Swagger sorting

浪子不回头ぞ 提交于 2019-12-24 01:27:31
问题 I want to organize my swagger api in reverse alphabetical order but it defaults to alphabetical. Is there a simple way to do this? Specifically using Swashbuckle.Core 5.2.1 回答1: You can create a sorter for the UI for both the operations ( operationsSorter ) and tags ( apisSorter ). 来源: https://stackoverflow.com/questions/33746676/override-swagger-sorting