Skip to content
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

Remove deprecated xatrr.TypeWithValidate interface #978

Open
bendbennett opened this issue Apr 12, 2024 · 0 comments
Open

Remove deprecated xatrr.TypeWithValidate interface #978

bendbennett opened this issue Apr 12, 2024 · 0 comments
Labels
breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change.
Milestone

Comments

@bendbennett
Copy link
Contributor

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 <Float64|Int64>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 <List|Map|Set>Type.ValueFromTerraform will call ValueFromTerraform on each of the elements.

References:

@bendbennett bendbennett added the breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. label Apr 12, 2024
@bendbennett bendbennett added this to the v2.0.0 milestone Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change.
Projects
None yet
Development

No branches or pull requests

1 participant