Skip to content

Add Swagger security schemes for admin and hidden routes#77

Merged
PunchTheDev merged 1 commit into
mainfrom
punch/swagger-security-scheme
Jun 4, 2026
Merged

Add Swagger security schemes for admin and hidden routes#77
PunchTheDev merged 1 commit into
mainfrom
punch/swagger-security-scheme

Conversation

@PunchTheDev
Copy link
Copy Markdown
Owner

Summary

The /docs Swagger UI was showing admin endpoints without any auth indicator — no lock icons, no security requirements visible. This looked like a design flaw and could confuse API consumers.

Changes

  • app/main.py: custom openapi() function that injects securitySchemes into the schema:
    • AdminToken: X-Admin-Token header for /admin/submissions/* routes (tagged admin)
    • BearerToken: Authorization: Bearer for /admin/hidden/* routes (tagged hidden)
  • Both lock icons now show in Swagger UI next to the respective endpoints
  • No behavioral changes — auth is still enforced by _require_admin_token() / _require_admin() in route handlers

@PunchTheDev PunchTheDev merged commit d72504e into main Jun 4, 2026
1 check passed
@PunchTheDev PunchTheDev deleted the punch/swagger-security-scheme branch June 4, 2026 02:16
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