databricks-cli/libs/dyn/convert
Pieter Noordhuis e4d039a1aa
Handle normalization of `dyn.KindTime` into an any type (#1836)
## Changes

The issue reported in #1828 illustrates how using a YAML timestamp-like
value (a date in this case) causes an issue during conversion to and
from the typed configuration tree.

We use the `AsAny()` function on the `dyn.Value` when normalizing for
the `any` type. We only use the `any` type for variable values, because
they can assume every type. The `AsAny()` function returns a `time.Time`
for the time value during conversion **to** the typed configuration
tree. Upon conversion **from** the typed configuration tree back into
the dynamic configuration tree, we cannot distinguish a `time.Time`
struct from any other struct.

To address this, we use the underlying string value of the time value
when we normalize for the `any` type.

Fixes #1828.

## Tests

Existing unit tests pass
2024-10-17 10:00:40 +00:00
..
end_to_end_test.go Fix conversion of zero valued scalar pointers to a dynamic value (#1433) 2024-05-21 11:53:00 +00:00
error.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
from_typed.go Track multiple locations associated with a `dyn.Value` (#1510) 2024-07-16 11:27:27 +00:00
from_typed_test.go Track multiple locations associated with a `dyn.Value` (#1510) 2024-07-16 11:27:27 +00:00
normalize.go Handle normalization of `dyn.KindTime` into an any type (#1836) 2024-10-17 10:00:40 +00:00
normalize_test.go Handle normalization of `dyn.KindTime` into an any type (#1836) 2024-10-17 10:00:40 +00:00
struct_info.go Add support for Lakehouse monitoring in bundles (#1307) 2024-05-31 09:42:25 +00:00
struct_info_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
to_typed.go Added JSON input validation for CLI commands (#1771) 2024-10-11 14:39:53 +00:00
to_typed_test.go Added JSON input validation for CLI commands (#1771) 2024-10-11 14:39:53 +00:00