bito-code-review[bot] commented on PR #43482:
URL: https://github.com/apache/superset/pull/43482#issuecomment-5399528281

   <!-- Bito Reply -->
   The flagged issue is correct. The current `model_validator` only checks if 
`identifier` and `permalink_key` are `None`, allowing empty strings to pass, 
which causes downstream resolution errors. To resolve this, you should update 
the validators to reject blank strings after trimming.
   
   Here is the corrected implementation for 
`superset/mcp_service/dashboard/schemas.py`:
   
   ```python
       @model_validator(mode="after")
       def _require_identifier_or_permalink(self) -> "GetDashboardInfoRequest":
           if (self.identifier is None or (isinstance(self.identifier, str) and 
not self.identifier.strip())) and \
              (self.permalink_key is None or not self.permalink_key.strip()):
               raise ValueError("Provide identifier or permalink_key")
           return self
   ```
   
   (Apply this same logic to `GetDashboardLayoutRequest` as well.)
   
   Would you like me to fetch all other comments on this PR to validate and 
implement fixes for them as well?
   
   **superset/mcp_service/dashboard/schemas.py**
   ```
   @model_validator(mode="after")
       def _require_identifier_or_permalink(self) -> "GetDashboardInfoRequest":
           if (self.identifier is None or (isinstance(self.identifier, str) and 
not self.identifier.strip())) and \
              (self.permalink_key is None or not self.permalink_key.strip()):
               raise ValueError("Provide identifier or permalink_key")
           return self
   ```


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