bito-code-review[bot] commented on code in PR #38490:
URL: https://github.com/apache/superset/pull/38490#discussion_r3526399597
##########
superset/databases/schemas.py:
##########
@@ -277,6 +277,29 @@ def extra_validator(value: str) -> str:
)
]
)
+
+ metadata_cache_timeout = extra_.get("metadata_cache_timeout") or {}
+ if not isinstance(metadata_cache_timeout, dict):
+ raise ValidationError(
+ [
+ _(
+ "The metadata_cache_timeout must be a mapping from "
+ "string keys to non-negative integer values."
+ )
+ ]
+ )
+ for key in ("schema_cache_timeout", "table_cache_timeout"):
Review Comment:
<!-- Bito Reply -->
The suggestion is appropriate as it ensures that any non-dictionary value
provided for `metadata_cache_timeout` is explicitly rejected with a
`ValidationError`, rather than silently defaulting to an empty dictionary. This
improves the robustness of the input validation logic by enforcing the expected
data type.
**superset/databases/schemas.py**
```
metadata_cache_timeout = extra_.get("metadata_cache_timeout")
if metadata_cache_timeout is not None:
if not isinstance(metadata_cache_timeout, dict):
raise ValidationError(
[
_(
"The metadata_cache_timeout must be a mapping
from "
"string keys to non-negative integer values."
)
]
)
else:
metadata_cache_timeout = {}
```
--
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]