You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the @headers("Authorization") annotation to inject that header into a method inside a TypeScript class, and it works as expected. However, NestJS is using this annotation and presenting it as a required header field, but then does not actually send that field in the API call.
I have main.ts configured so that the swagger UI page has the "Authorize" button, and entering a value there causes the token to be sent correctly.
However, that makes the value under Parameters unnecessary and even wrong (since it isn't sent anyway). In the screenshot below I did not use the Authorization button at the top of the screen to "Authenticate" in order to illustrate that the value in Parameters is not useful.
I have tried various combinations of @Api annotations to no avail. Ideally there would be a way to suppress the unused Parameters field. The closest I can get is to make the field optional using @ApiHeader({name: "Authorization", required: false}), but again, this is wrong since anything entered in that field isn't actually sent anyway.
Is there an existing issue for this?
Current behavior
I am using the @headers("Authorization") annotation to inject that header into a method inside a TypeScript class, and it works as expected. However, NestJS is using this annotation and presenting it as a required header field, but then does not actually send that field in the API call.
I have
main.ts
configured so that the swagger UI page has the "Authorize" button, and entering a value there causes the token to be sent correctly.However, that makes the value under Parameters unnecessary and even wrong (since it isn't sent anyway). In the screenshot below I did not use the
Authorization
button at the top of the screen to "Authenticate" in order to illustrate that the value in Parameters is not useful.I have tried various combinations of @Api annotations to no avail. Ideally there would be a way to suppress the unused Parameters field. The closest I can get is to make the field optional using
@ApiHeader({name: "Authorization", required: false})
, but again, this is wrong since anything entered in that field isn't actually sent anyway.Minimum reproduction code
https://github.com/mwarner1/swagger-bug-demo
Steps to reproduce
No response
Expected behavior
Swagger should not use
@Header
fields to define parameters.Package version
11.0.1
NestJS version
4.0.0
Node.js version
20.16.0
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: