databricks-cli/libs/dyn/convert
Pieter Noordhuis 446a9d0c52
Properly deal with nil values in `convert.FromTyped` (#1511)
## Changes

When a configuration defines:
```yaml
run_as:
```

It first showed up as `run_as -> nil` in the dynamic configuration only
to later be converted to `run_as -> {}` while going through typed
conversion. We were using the presence of a key to initialize an empty
value. This is incorrect and it should have remained a nil value.

This conversion was happening in `convert.FromTyped` where any struct
always returned a map value. Instead, it should only return a map value
in any one of these cases: 1) the struct has elements, 2) the struct was
originally a map in the dynamic configuration, or 3) the struct was
initialized to a non-empty pointer value.

Stacked on top of #1516 and #1518.

## Tests

* Unit tests pass.
* Integration tests pass.
* Manually ran through bundle CRUD with a bundle without resources.
2024-06-21 13:43:21 +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 Properly deal with nil values in `convert.FromTyped` (#1511) 2024-06-21 13:43:21 +00:00
from_typed_test.go Properly deal with nil values in `convert.FromTyped` (#1511) 2024-06-21 13:43:21 +00:00
normalize.go Convert between integer and float in normalization (#1371) 2024-04-17 08:58:07 +00:00
normalize_test.go Convert between integer and float in normalization (#1371) 2024-04-17 08:58:07 +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 Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
to_typed_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00