rusackas opened a new pull request, #40908:
URL: https://github.com/apache/superset/pull/40908

   ### SUMMARY
   
   Adopts #34407 by @rsbhatti — thank you for the original work! 🙏
   
   When Superset is deployed behind a reverse proxy with a URL prefix 
(`APPLICATION_ROOT` / `SUPERSET_APP_ROOT`), the Swagger UI breaks because it 
can't generate the OpenAPI server URLs or locate the spec under the prefix 
(#33304). This adds an `APPLICATION_ROOT`-aware OpenAPI endpoint 
(`/api/<version>/_openapi`) and Swagger view, gated by a new config flag:
   
   ```python
   FAB_API_SWAGGER_UI_SUPERSET_APP_ROOT = False  # default: standard FAB 
Swagger UI
   ```
   
   When enabled, the spec's `servers` URL and the Swagger UI's `openapi_uri` 
are resolved through `APPLICATION_ROOT`, so the docs work under a prefix. 
Default behavior is unchanged.
   
   ### What changed vs. the original PR
   
   I adopted #34407 and applied a few cleanups so it's merge-ready:
   - **Kept** the existing `FAB_API_SWAGGER_UI = True` flag (the original 
inadvertently removed it).
   - **Dropped** an unrelated `AUTH_ROLE_PUBLIC = 'Public'` change the original 
accidentally included.
   - Added **ASF license headers** and **type hints** to the new 
`superset/openapi` module.
   - Fixed the `SupsersetSwaggerView` → `SupersetSwaggerView` class-name typo.
   - Added a unit test for the schema-name resolver.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — backend; gated behind a default-off config flag.
   
   ### TESTING INSTRUCTIONS
   
   ```
   pytest tests/unit_tests/openapi/test_manager.py
   ```
   
   Manual: set `APPLICATION_ROOT = "/myprefix"` and 
`FAB_API_SWAGGER_UI_SUPERSET_APP_ROOT = True`, then load the Swagger UI under 
the prefix and confirm the spec loads and server URLs include the prefix.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #33304
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Closes #34407
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to