Releases: zclconf/go-cty
v1.17.0
cty
now requires Go 1.23 or later.
-
cty.Value.Elements
offers a moderniter.Seq2
-based equivalent ofcty.Value.ElementIterator
. -
cty.DeepValues
offers a moderniter.Seq2
-based equivalent ofcty.Walk
. -
cty.Value.WrangleMarksDeep
allows inspecting and modifying individual marks throughout a possibly-nested data structure.Having now got some experience using marks more extensively in some callers, it's become clear that it's often necessary for different subsystems to be able to collaborate using independent marks without upsetting each other's assumptions. Today that tends to be achieved using hand-written transforms either with
cty.Transform
orcty.Value.UnmarkDeepWithPaths
/cty.Value.MarkWithPaths
, both of which can be pretty expensive even in the common case where there are no marks present at all.This new function allows inspecting and transforming marks with far less overhead, by creating new values only for parts of a structure that actually need to change and by reusing (rather than recreating) the "payloads" of the values being modified when we know that only the marks have changed.
-
cty.ValueMarksOfType
andcty.ValueMarksOfTypeDeep
make it easier to use type-based rather than value-based mark schemes, where different values of a common type are used to track a specific kind of relationship with multiple external values. -
cty.Value.HasMarkDeep
provides a "deep" version of the existingcty.Value.HasMark
, searching throughout a possibly-nested structure for any values that have the given mark. -
cty.Value.UnmarkDeep
andcty.Value.UnmarkDeepWithPaths
are now implemented in terms ofcty.Value.WrangleMarksDeep
, so they benefit from its reduced overhead. In particular they avoid reconstructing a data structure that contains no marked values at all. -
cty.Value.MarkWithPaths
now has a fast path when it's given a zero-lengthPathValueMarks
, in which case it just returns the value it was given with no modifications.
v1.16.0
convert
: When converting between two different capsule types, will now try to use the "conversion from" implementation from the target type if the source type doesn't have a suitable "conversion to" implementation. (#194)convert
: When converting to a map whose element type is an object type with optional attributes, will no longer construct a broken result when a final map is empty. (#198)
v1.13.2
v1.12.2
v1.13.1
v1.13.1
v1.13.0
v1.13.0
v1.11.1
convert
: Fix for error when converting empty sets and lists with nested optional attributes by explicitly removing optional attribute information from collections.
v1.9.1
v1.9.1
v1.5.0
cty
: NewValue.HasWhollyKnownType
method, for testing whether a value's type could potentially change if any unknown values it was constructed from were to become known. (#55)convert
: Fix incorrect panic when converting a tuple with a dynamic-typed null member into a list or set, due to overly-liberal type unification. (#56)