bito-code-review[bot] commented on code in PR #35798:
URL: https://github.com/apache/superset/pull/35798#discussion_r2452353100
##########
superset/charts/schemas.py:
##########
@@ -213,7 +213,7 @@ class ChartPostSchema(Schema):
query_context = fields.String(
metadata={"description": query_context_description},
allow_none=True,
- validate=utils.validate_json,
+ validate=utils.validate_query_context_metadata,
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Breaking validation change for query_context</b></div>
<div id="fix">
Changing the validation for `query_context` from `validate_json` to
`validate_query_context_metadata` introduces stricter requirements that mandate
'datasource' and 'queries' fields in the JSON. This could break existing chart
creation operations where `query_context` is provided as valid JSON but lacks
these specific fields, potentially causing validation failures in production.
The `ChartCreateSchema` and `ChartUpdateSchema` classes are impacted, affecting
both new chart creation and updates through functions like chart API endpoints
that deserialize input using these schemas.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
- validate=utils.validate_query_context_metadata,
+ validate=utils.validate_json,
)
@@ -276,4 +276,4 @@
query_context = fields.String(
metadata={"description": query_context_description},
allow_none=True,
- validate=utils.validate_query_context_metadata,
+ validate=utils.validate_json,
)
```
</div>
</details>
</div>
<small><i>Code Review Run <a
href=https://github.com/apache/superset/pull/35798#issuecomment-3432675853>#804563</a></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]