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


##########
superset/initialization/__init__.py:
##########
@@ -846,6 +846,25 @@ def configure_fab(self) -> None:
         appbuilder.security_manager_class = custom_sm
         appbuilder.init_app(self.superset_app, db.session)
 
+    def configure_openapi_prefix(self) -> None:
+        """Ensure OpenAPI/Swagger endpoints respect SUPERSET_APP_ROOT prefix 
routing.
+        
+        Fixes: https://github.com/apache/superset/issues/33304
+        Must be called after init_views() so blueprints are already registered.
+        """
+        import os
+        
+        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 rule in self.superset_app.url_map.iter_rules():
+                if "openapi" in rule.endpoint and not 
rule.rule.startswith(prefix):
+                    rule.rule = f"{prefix}{rule.rule}"
+

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing test coverage for new method</b></div>
   <div id="fix">
   
   No tests exist for the new `configure_openapi_prefix()` method. BITO.md 
adaptive_rules [6262] emphasizes testing actual business logic — this method 
modifies URL routing behavior and should be validated.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #950a7d</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