Skip to content

Commit

Permalink
[ES|QL] Create validation errors for unknown parameters (elastic#197334)
Browse files Browse the repository at this point in the history
## Summary

Follow-up from elastic#195989.

We discussed as a team and decided to show validation errors when an
unknown variable is used as an argument to subsequent functions.

**Before**
<img width="589" alt="Screenshot 2024-10-22 at 1 41 08 PM"
src="https://github.com/user-attachments/assets/872d3302-ddfe-415f-9c98-e2c682344189">


**After**
<img width="570" alt="Screenshot 2024-10-22 at 1 41 29 PM"
src="https://github.com/user-attachments/assets/b7e29c2d-ee40-4730-b1ab-43d95dfd264c">
  • Loading branch information
drewdaemon authored Oct 23, 2024
1 parent 5f4742c commit e1c0cef
Show file tree
Hide file tree
Showing 2 changed files with 226 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export function checkFunctionArgMatchesDefinition(
const wrappedTypes: Array<(typeof validHit)['type']> = Array.isArray(validHit.type)
? validHit.type
: [validHit.type];
return wrappedTypes.some((ct) => ct === argType || ct === 'null' || ct === 'unknown');
return wrappedTypes.some((ct) => ct === argType || ct === 'null');
}
if (arg.type === 'inlineCast') {
const lowerArgType = argType?.toLowerCase();
Expand Down
Loading

0 comments on commit e1c0cef

Please sign in to comment.