You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two different bugs interacted here to cause a cty.DynamicVal to end up
encoding as nothing at all, with no error:
- The main marshal function was checking for dynamic type before checking
for unknown value, so cty.DynamicVal was being passed to marshalDynamic.
- marshalDynamic was not checking the error result from encoding the
value, and so was successfully returning nothing at all.
This situation will now return the same "value is not known" error that
the function previously returned for all other situations where the
given value is unknown. The JSON representation of cty values can only
represent fully-known values.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
3
3
*`msgpack`: Now uses string encoding instead of float encoding for a whole number that is too large to fit in any of MessagePack's integer types.
4
4
*`function/stdlib`: Type conversion functions (constructed with `MakeToFunc`) can now convert null values of unknown type into null values of the target type, rather than returning an unknown value in that case.
5
+
*`json`: Will now correctly reject attempts to encode `cty.DynamicVal`, whereas before it would just produce an invalid JSON document without any error. (This is invalid because JSON encoding cannot support unknown values at all; `cty.DynamicVal` is a special case of unknown value where even the _type_ isn't known.)
0 commit comments