Reputation: 4582
Some of my controllers require custom headers to be defined in a valid request.
The only way I know so far to add headers is to explicitly define a [FromHeader(Name = "X-Custom-Data")]
parameter in my action methods.
I however have a middleware that runs before the action method is invoked and the headers are evaluated in this middleware. Thus I don't really need the header's value in the action itself.
What I'm looking for now is a way to let the swagger generator know that a custom header is needed for this request without having to specify those as method parameters.
As I wasn't able to find any attributes like [SwaggerResponse]
but for headers I wanted to ask you guys if you know any solution to this.
Upvotes: 1
Views: 3534
Reputation: 11858
You can add them with a custom operation or document processor:
Upvotes: 2