hashicorp / hashicorp/terraform-plugin-framework
Remove deprecated `xatrr.TypeWithValidate` interface
- Dominant language
- Go
- Stars
- 384
- Forks
- 107
- Avg merge
- 3m
- Merged PRs (30d)
- 1
Description
Changes in #968 included the deprecation of the `xattr.TypeWithValidate` interface. As part of the preparation for the release of `v2.x` of the Framework we should remove the `xattr.TypeWithValidate` interface and all usages.
A further consideration is the removal of the implementation of `xattr.TypeWithValidate` from the basetypes `Float64Type`, `Int64Type`, `ListType`, `MapType` and `SetType`.
For `Float64Type`, `Int64Type`, it may not be necessary to implement the equivalent validation on `Float64Value`, `Int64Value` as the calls to `Type.ValueFromTerraform` ensure that the `tftypes.Value` supplied can be represented as 64-bit floating point, and integer values, respectively. The constructors on the corresponding value types only accept 64-bit floating point, and integer values too (e.g., `NewFloat64Value`). So it doesn't seem that there is a way to generate a `Float64Value` or an `Int64Value` type that would have a value that couldn't be represented as a 64-bit floating point, or integer value, respectively.
The base types `ListType`, `MapType` and `SetType` also implement `xatrr.TypeWithValidate`, iterating over their elements and calling `Validate()` on each. If it is unnecessary to implement validation on `Float64Value`, `Int64Value` value types, for the reasons outlined, then it may not be necessary to implement validation on `ListValue`, `MapValue` and `SetValue` types either as the call to `Type.ValueFromTerraform` will call `ValueFromTerraform` on each of the elements.
References:
- #589
- #968
- #893
Contributor guide
Assessment
This issue has not been assessed yet.