How do I tell swashbuckle to add a required header
See original GitHub issueI have one of my API controller that requires a header to be present (this is not a security header).
From what I’ve found on the internet (http://stackoverflow.com/questions/26742521/sending-dynamic-custom-headers-in-swagger-ui-try-outs), in java you can use http://docs.swagger.io/swagger-core/apidocs/com/wordnik/swagger/annotations/ApiImplicitParam.html with a paramType=“header”
@ApiImplicitParams(
{ @ApiImplicitParam(paramType="header", name="X-CurrentLocale", dataType="string") }
)
How do I do the same in Swashbuckle ?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:19 (1 by maintainers)
Top Results From Across the Web
c# - Web Api How to add a Header parameter for all API in ...
If swagger is used in ASP.Net MVC5, and required to add headers to get input from swagger UI. Give reference of this class...
Read more >Adding a Required HTTP Header to Your Swagger UI With ...
Let's first look at a simple swagger setup as our baseline before we add everything for our HTTP Header Field. ... config.SwaggerDoc( "v1"...
Read more >Swagger UI - Add required header
Let's see how we can get this done through SwashBuckle. First I need to create a custom IOperationFilter that will add the header: ......
Read more >Add a Header parameter to .NET Core API in Swagger
Add a Custom header parameter to .NET Core API in Swagger –OpenAPI · Step1 – Create ASP.NET Core API · Step2: Install the...
Read more >Add an authorization header to your swagger-ui with ...
First, you need to tell Swashbuckle what security your API has: ... to do is tell Swashbuckle which of our actions require Authorization....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In addition, if you’d like to list the header as a parameter with each operation description, you can just wire it up via an IOperationFilter (see readme). Here’s some sample code to get you started:
It works only for post method, how about get ?