Skip to content

fix: use distinct scheme_name on APIKeyHeader so Swagger shows correct curl headers (#80)#319

Open
Som23Git wants to merge 1 commit intoVexa-ai:mainfrom
Som23Git:fix/80-swagger-admin-header-scheme-name
Open

fix: use distinct scheme_name on APIKeyHeader so Swagger shows correct curl headers (#80)#319
Som23Git wants to merge 1 commit intoVexa-ai:mainfrom
Som23Git:fix/80-swagger-admin-header-scheme-name

Conversation

@Som23Git
Copy link
Copy Markdown

@Som23Git Som23Git commented May 5, 2026

Brief updates:

  • Add scheme_name="AdminApiKey" to API_KEY_HEADER (X-Admin-API-Key)
  • Add scheme_name="UserApiKey" to USER_API_KEY_HEADER (X-API-Key)
  • FastAPI collapses both into one scheme when scheme_name is missing, causing Swagger to show X-API-Key for all routes including admin ones
  • Add regression test (test_openapi_schema.py) that validates both schemes exist in /openapi.json with correct header names. It's additional but, it's good way to test it programmatically.

Manual tests:

Addresses this comment.

image
# Request
curl -X 'POST' \
  'http://localhost:8057/admin/users' \
  -H 'accept: application/json' \
  -H 'X-Admin-API-Key: newadmintoken' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "user@example.com",
  "name": "string",
  "image_url": "string",
  "max_concurrent_bots": 0,
  "data": {
    "additionalProp1": {}
  }
}'
# Response
{
  "email": "user@example.com",
  "name": "string",
  "image_url": "string",
  "max_concurrent_bots": 0,
  "data": {},
  "id": 3,
  "created_at": "2026-05-05T20:30:37.591537"
}

Closes #80

And, attaching my virtually consented/signed Individual CLA per CONTRIBUTING.md

individual-cla.pdf

…t curl headers

- Add scheme_name="AdminApiKey" to API_KEY_HEADER (X-Admin-API-Key)
- Add scheme_name="UserApiKey" to USER_API_KEY_HEADER (X-API-Key)
- FastAPI collapses both into one scheme when scheme_name is missing,
  causing Swagger to show X-API-Key for all routes including admin ones
- Add regression test (test_openapi_schema.py) that validates both schemes
  exist in /openapi.json with correct header names

Closes Vexa-ai#80
@Som23Git Som23Git changed the title fix: use distinct scheme_name on APIKeyHeader so Swagger shows correct curl headers fix: use distinct scheme_name on APIKeyHeader so Swagger shows correct curl headers (#80) May 5, 2026
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.

Admin API Swagger UI Shows Wrong Header in curl Examples

1 participant