databricks-cli/bundle/permissions
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
..
filter.go Properly deal with nil values in `convert.FromTyped` (#1511) 2024-06-21 13:43:21 +00:00
filter_test.go Fixed panic when loading incorrectly defined jobs (#1402) 2024-05-17 10:10:17 +00:00
mutator.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
mutator_test.go Fixed panic when loading incorrectly defined jobs (#1402) 2024-05-17 10:10:17 +00:00
utils.go Added support for top-level permissions (#928) 2023-11-13 11:29:40 +00:00
workspace_root.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
workspace_root_test.go Fixed panic when loading incorrectly defined jobs (#1402) 2024-05-17 10:10:17 +00:00