aminghadersohi commented on code in PR #42144:
URL: https://github.com/apache/superset/pull/42144#discussion_r3616292674


##########
superset/mcp_service/dataset/schemas.py:
##########
@@ -865,6 +891,14 @@ class QueryDatasetRequest(QueryCacheControl):
         description="Maximum number of rows to return (default 1000, max 
50000).",
     )
 
+    @field_validator("time_range")
+    @classmethod
+    def normalize_time_range(cls, v: str | None) -> str | None:
+        if v is None:
+            return v
+        canonical = _BRACKET_SHORTHAND_TO_TIME_RANGE.get(v.strip().lower())
+        return canonical if canonical is not None else v

Review Comment:
   Confirmed — the validator stripped whitespace only for the bracket-shorthand 
lookup key and fell back to returning the raw, untrimmed `v` when no shorthand 
matched. Fixed by stripping once and returning the stripped value on both paths 
(`superset/mcp_service/dataset/schemas.py`). Added a regression test 
(`test_non_bracket_value_is_stripped`). See 03b2b56dd0.



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