swashbuckle

Adding Nested Grouping Sections in the UI for Actions within a Controller

本小妞迷上赌 提交于 2019-12-02 11:37:48
Is it possible to have subsections within an action grouping? We currently use Controller-based differentiation to group functions, but are hosting a large amount of controllers and could use further nesting. In other words, I know actions can be grouped/ordered with the following, but can they be grouped multiple times: c.GroupActionsBy(apiDesc => apiDesc.HttpMethod.ToString()); c.OrderActionGroupsBy(new DescendingAlphabeticComparer()); Thanks for all the help! In theory yes, we can group actions multiple times we can create an insanity of nested groups, swagger & swashbuckle are both open

Web API Documentation using swagger

ⅰ亾dé卋堺 提交于 2019-12-02 07:34:39
问题 I am new to swagger, I have seen couple of online documentation to implement Swagger to my webapi and used some of the properties of SwaggerConfig to customize. Here is my requirement :- I need to show swagger documentation only on "Explore" button click based on the value of "API_Key" TextBox which should match with my app.config key. So I am seeing to implement like this:- User comes to my swagger home page, by default it will have empty documentation, except the header as shown in the

Swashbuckle MapType<Type> doesn't work with parameters

筅森魡賤 提交于 2019-12-02 07:20:14
问题 I've got an API endpoint that takes a ShortGuid class as a parameter, like such: [HttpGet("api/endpoint")] public async Task<IActionResult> GetTablesAsync(ShortGuid id){} Generates a swagger definition of: "parameters":[ { "name":"guid", "in":"query", "required":false, "type":"string", "format":"uuid" }, { "name":"value", "in":"query", "required":false, "type":"string" } ], I need to treat that parameter as a string, not a ShortGuid object. I already have a JsonConverter for the type that

Web API Documentation using swagger

泄露秘密 提交于 2019-12-02 04:25:11
I am new to swagger, I have seen couple of online documentation to implement Swagger to my webapi and used some of the properties of SwaggerConfig to customize. Here is my requirement :- I need to show swagger documentation only on "Explore" button click based on the value of "API_Key" TextBox which should match with my app.config key. So I am seeing to implement like this:- User comes to my swagger home page, by default it will have empty documentation, except the header as shown in the image. Enters API_Key in the textbox provided in the header and click on Explore. Entered API key is

I'm not getting a scope checkbox when the Authorize tag doesn't contain roles, Ajax authorization request not sending scope either

99封情书 提交于 2019-12-02 04:07:39
问题 UPDATE 2: If I change my controller Authorize tag from this [Authorize] to this [Authorize(Roles = "Read")] then I get the checkbox for scope selection and the ajax token request contains the correct scope and completes successfully. I still end up with a red exclamation mark however. It looks like Swagger or Swashbuckle is requiring that the roles match the scope definitions? Is it possible to use the application flow with no Roles defined when using Swashbuckle? And if so how do you get

I'm not getting a scope checkbox when the Authorize tag doesn't contain roles, Ajax authorization request not sending scope either

纵然是瞬间 提交于 2019-12-02 01:26:42
UPDATE 2: If I change my controller Authorize tag from this [Authorize] to this [Authorize(Roles = "Read")] then I get the checkbox for scope selection and the ajax token request contains the correct scope and completes successfully. I still end up with a red exclamation mark however. It looks like Swagger or Swashbuckle is requiring that the roles match the scope definitions? Is it possible to use the application flow with no Roles defined when using Swashbuckle? And if so how do you get that to work? Do I have to manually set the scope in the operation filter class? If it's not possible to

Adding Query String Params to my Swagger Specs

拥有回忆 提交于 2019-12-01 04:00:41
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 swagger does support parameter in 'query' but how do I get Swashbuckle to do it? I mention in one of the comments that I solved my issue by creating a custom attribute to allow me to do what I needed. Below is the code for my solution: [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] public class

Add Authentication to /swagger/ui/index page - Swagger | Web API | Swashbuckle

穿精又带淫゛_ 提交于 2019-12-01 03:06:08
问题 I'm working on a Swagger (Web API) project. When I first run the application it shows the Login page for Swagger UI. So, a user first has to login to access Swagger UI Page, However, if user directly enters "http://example.com/swagger/ui/index" then he's able to access the Swagger UI page. afaik the swagger-ui is served by the swashbuckle assembly. The source is not available in my project. How can I make the user redirect to login page if he's not logged in to Swagger UI page? 回答1: Finally,

ASP.NET Core - Swashbuckle not creating swagger.json file

与世无争的帅哥 提交于 2019-12-01 02:04:32
I am having trouble getting the Swashbuckle.AspNetCore (1.0.0) package to generate any output. I read the swagger.json file should be written to '~/swagger/docs/v1'. However, I am not getting any output. I started with a brand new ASP.NET Core API project. I should mention this is ASP.NET Core 2. The API works, and I am able to retrieve values from the values controller just fine. My startup class has the configuration exactly as described in this article ( Swashbuckle.AspNetCore on GitHub ). public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; }

Adding Query String Params to my Swagger Specs

我怕爱的太早我们不能终老 提交于 2019-12-01 01:11:59
问题 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 swagger does support parameter in 'query' but how do I get Swashbuckle to do it? I mention in one of the comments that I solved my issue by creating a custom attribute to allow me to do what I needed. Below is the code for my solution: [AttributeUsage