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
Add support for embedded structs in structdiff (#3759)
## Changes
This change adds proper handling of anonymous (embedded) struct fields
in the structdiff package. When comparing structs with embedded fields,
the embedded struct's fields now appear at the root level of the path
rather than being prefixed with the embedded struct's name.
For example, with:
```go
type Embedded struct {
Field string `json:"field"`
}
type Container struct {
Embedded
Name string `json:"name"`
}
```
A change to `Field` will be reported as "field" instead of
"Embedded.field".
## Why
Dashboards have embedded strings in the resource definition. This is
needed so that specifying `parent_path` as a key works in field
triggers. Otherwise you would need to specify `Dashboard.parent_path` to
account for the embedded struct.
## Tests
Added comprehensive test coverage for:
- Single embedded field changes
- Multiple embedded field changes
- Mixed embedded and non-embedded field changes
- Zero to non-zero transitions with omitempty
- Non-zero to zero transitions
All test cases include mirror tests and self-comparison tests.
0 commit comments