Skip to content

fix(api playground): rm duplicate authorization header - #288

Merged
rgodha24 merged 1 commit into
mainfrom
rohan/openapi-bearer-dup
Nov 18, 2026
Merged

rgodha24 merged 1 commit into
mainfrom
rohan/openapi-bearer-dup

Conversation

@rgodha24

Copy link
Copy Markdown
Member
clank context (clickme)

What was wrong

POST /auth/api_key/jwt and GET /auth/test-auth documented Authorization twice in docs/openapi.json: once through the API_Key bearer security scheme, and again as a plain required header parameter (an explicit @ApiHeader on both, and on api_key/jwt also the swagger plugin's param inferred from @Headers('Authorization')). In the Mintlify playground the plain header wins. It sends whatever is typed with no Bearer prefix, so Try it returns 401 API Key is required unless the reader types Bearer themselves. test-auth also took a user JWT but was labeled with the API_Key scheme.

Fix

  • Drop both @ApiHeader({ name: 'Authorization' }) decorators.
  • getApiKeyJWT reads @Headers() and uses headers.authorization (same parsing), so the plugin stops adding the header param.
  • Add a JWT bearer scheme in openapi.ts and use it on test-auth.

docs/openapi.json isn't in the diff because the openapi workflow regenerates it on push to main.

Test plan

  • Built the api-gateway dev image on a tesser box and ran pnpm gen:openapi in it. Both operations now list no parameters. Security is [{API_Key: []}] on api_key/jwt and [{JWT: []}] on test-auth, and components.securitySchemes has API_Key and JWT.
  • nx run api-gateway:tsc and eslint on both files pass in that image. Prettier check passes.
  • I did not run the auth e2e suite (it times out on tesser), so CI covers runtime. Behavior should be unchanged: same header, same split(' ')[1].
  • Found while running a Mintlify demo of the API reference. With the duplicate header removed in the demo's copy of the spec, Try it on api_key/jwt returned 201.

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Disclaimer: This comment was AI-generated and is not necessarily completely accurate. Please take code comments with a grain of salt.

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge; no actionable issues were found.

Summary

Removes duplicate authorization fields from the API playground and labels the user-token check with the correct credential type.

  • The API reference shows the right bearer scheme for each auth route.

Checklist: No areas needing improvement found in the changed code. Tests and lint were not run during this review.

Score: 100/100.

Reviews (1) · Last reviewed commit: "fix(api playground): rm duplicate author..." · Reviewed by Greptile

@rgodha24
rgodha24 merged commit efaee67 into main Nov 18, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant