NSwag Response Headers
See original GitHub issueI tried to use OpenApiResponse.Headers to define the response headers but it seems this functionality does not work as expected.
Actual:
responses:
'200':
description: OK
headers:
X-RateLimit-Limit:
type: integer
description: Request limit per hour
Expected:
responses:
'200':
description: OK
headers:
X-RateLimit-Limit:
schema:
type: integer
description: Request limit per hour.
On top of that, NSwag has the following limitations in regard to response headers:
- Cannot set header name
- Cannot set header description
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
NSwag Response Headers - swagger
How Response Headers can be set in NSwag? I tried to add to OpenApiResponse.Headers collection. var headerSchema = new JsonSchema() { Type ...
Read more >Generate TypeScript and C# clients with NSwag based on ...
Learn how to generate TypeScript and C# API clients with NSwag to reduce ... stacktraces, network requests/responses with headers + bodies, ...
Read more >Get started with NSwag and ASP.NET Core
Learn how to use NSwag to generate documentation and help pages for an ASP. ... http://localhost:<port>/swagger to view the Swagger UI.
Read more >Add Custom Header and handle it ...
Zero use nswag so service proxy is auto generated, I am not able to add any thing to header of request. How can...
Read more >Is it a best practice to use NSwag generated code for calls ...
My thought is that instead of NSwag, one can inject an HTTPClient, ... This includes information such as response headers, the http status ......
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
I think I figured it out. Adding the response header as an
OpenApiParameter
seems to generate the correct schema for a response header:Thanks @cjlotz, your solution fixed my issue.