-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client-side implementation of provider functions #34385
Conversation
Add the types, methods, and basic framework to use provider defined functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me. One thing I'm not quite clear on is behaviour with marked values passed as arguments to a function call. Is that covered somewhere that I'm not seeing, or not implemented yet?
} | ||
args[i] = argVal | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see we're checking for too many parameters here, but what happens if we don't have enough parameters in the request?
if len(r.Arguments) < len(funcDecl.Parameters) { | ||
resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("not enough arguments for function %q", r.FunctionName)) | ||
return resp | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I think this answers my question above, unless I'm misunderstanding!
Marks are automatically handled by the cty function call implementation (called via a function expression within hcl), which transfers the marks from the arguments to the result. |
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
This PR build on #34383, adding the machinery to handle the new provider defined functions in the update protocol. We add the grpc handling code, add internal interface types and methods, and and flush out the various internal implementations which fulfill the provider interface.