bito-code-review[bot] commented on code in PR #40445:
URL: https://github.com/apache/superset/pull/40445#discussion_r3304989886


##########
superset/initialization/__init__.py:
##########
@@ -846,6 +846,14 @@ def configure_fab(self) -> None:
         appbuilder.security_manager_class = custom_sm
         appbuilder.init_app(self.superset_app, db.session)
 
+        # Ensure OpenAPI/Swagger endpoints respect prefix routing (Issue 
#33304)
+        app_root = self.superset_app.config.get("APPLICATION_ROOT") or 
os.environ.get("SUPERSET_APP_ROOT")
+        if app_root and app_root.strip("/"):
+            prefix = f"/{app_root.strip('/')}"
+            for blueprint in self.superset_app.blueprints.values():
+                if blueprint.name == "openapi":
+                    blueprint.url_prefix = f"{prefix}{blueprint.url_prefix or 
''}"

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Dead code - timing issue</b></div>
   <div id="fix">
   
   Move the prefix-routing block from `configure_fab()` to the end of 
`init_app_in_ctx()` after `self.init_views()` so the openapi blueprint is 
registered before updating its `url_prefix`.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #8f8276</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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