Commit Graph

2 Commits

Author SHA1 Message Date
Evan
1d814383c2 fix(swagger): avoid route collision, respect global Swagger flag, normalize app root
Address review feedback:
- Gate the APPLICATION_ROOT-aware Swagger/OpenAPI registration on
  FAB_API_SWAGGER_UI so the global Swagger disable still takes precedence.
- Suppress FAB's default OpenAPI/Swagger views (FAB_ADD_OPENAPI_VIEWS) when
  the prefix-aware variant is active, so the two don't register duplicate URL
  rules for /api/<version>/_openapi and /swagger/<version>.
- Normalize APPLICATION_ROOT (treat '/' as empty, strip trailing slash) so the
  Swagger UI spec URL is not built as a protocol-relative '//api/...' URL.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 10:50:17 -07:00
Claude Code
b53a6e0b11 fix(swagger): support URL prefix via APPLICATION_ROOT in OpenAPI and Swagger UI
Adopts #34407 by @rsbhatti. Serves the OpenAPI spec and an APPLICATION_ROOT-aware
Swagger UI for Superset deployments behind a URL prefix (reverse proxy), gated by
a new FAB_API_SWAGGER_UI_SUPERSET_APP_ROOT flag (default False).

Adoption cleanups over the original:
- keep the existing FAB_API_SWAGGER_UI flag (the original removed it)
- drop an unrelated AUTH_ROLE_PUBLIC change that the original accidentally included
- add ASF license headers and type hints to the new openapi module
- fix the SupsersetSwaggerView -> SupersetSwaggerView class-name typo
- add a unit test for the schema-name resolver

Closes #34407
Fixes #33304

Co-authored-by: rsbhatti <rajvindrasinghbhatti12@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 09:46:50 -07:00