korbit-ai[bot] commented on code in PR #32218:
URL: https://github.com/apache/superset/pull/32218#discussion_r1950645361
##########
superset-frontend/src/components/Datasource/utils.js:
##########
@@ -121,7 +121,7 @@ export function updateColumns(prevCols, newCols,
addSuccessToast) {
export async function fetchSyncedColumns(datasource) {
const params = {
- datasource_type: datasource.type,
+ datasource_type: datasource.type || datasource.datasource_type,
Review Comment:
### Missing Validation for Required Datasource Type <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The fallback logic lacks null checking, which could still result in
undefined being assigned to datasource_type if both properties are null.
###### Why this matters
If both datasource.type and datasource.datasource_type are null, the
parameter will be null, potentially causing issues with the API endpoint that
expects a valid datasource type.
###### Suggested change ∙ *Feature Preview*
Add validation to ensure a valid datasource type is always provided:
```javascript
const sourceType = datasource.type || datasource.datasource_type;
if (!sourceType) {
throw new Error('Datasource type is required');
}
params = {
datasource_type: sourceType,
// ... rest of the params
};
```
</details>
<sub>
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ba918717-e5cb-421c-97a0-bb8ae69a0c5e?suggestedFixEnabled=true)
💬 Chat with Korbit by mentioning @korbit-ai.
</sub>
<!--- korbi internal id:4f098f06-c474-4e78-9cda-d1f1aea63759 -->
--
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]