Closed bendbennett closed 7 months ago
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. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Closes: #589 Closes: #893
Background
Provider-defined functions can accept parameters, or arguments as input. There is an opportunity to provide validation of such parameters in an analogous manner to the validation of values supplied in configuration for attributes, by implementing parameter-based and type-based validation for provider-defined function parameters.
This PR is concerned with the addition of type-based validation, which enables provider developers using custom value types to implement parameter validation.
Validation Package
This PR adds type-based provider-defined function parameter validation through the introduction of a
validation
package with a newValidateableParameter
interface.Deprecation of
xattr.TypeWithValidate
This PR also introduces a new
ValidateableAttribute
interface, and deprecates thexattr.TypeWithValidate
interface. Provider developers who are using custom value types that will be used in the context of both attribute validation and parameter validation would need to implement both interfaces on the custom value type, but could share the validation logic to reduce duplication.