Skip to content

Commit 0695fbb

Browse files
Fix QuickSight DataSet code generation compile errors (#676)
## Fix compile errors for controllers with timestamp lists and union map values ### Problem The quicksight controller (and any controller with `[]timestamp` fields or union-typed map values) fails to compile due to two categories of code generation bugs: 1. **Timestamp lists generate `[]*metav1.Time`**, which causes `controller-gen`'s deepcopy generator to emit invalid code — it passes `**metav1.Time` to `DeepCopyInto` which expects `*metav1.Time`. 2. **Union types used as map values** (e.g., `PhysicalTableMap`) are treated as regular structs. In SDK v2, unions are interfaces, so the generated code incorrectly creates composite literals of interface types and accesses fields that don't exist on the interface. ### Fix **Timestamp lists** (`types.go`, `model.go`, `set_resource.go`, `set_sdk.go`): - Generate `[]metav1.Time` instead of `[]*metav1.Time` for list-of-timestamp fields - Update SDK↔CRD conversion to use value types (not pointers) for timestamp list elements, matching SDK v2's `[]time.Time` - Fix `varEmptyConstructorK8sType` to emit correct `metav1.Time` types for timestamp elements and slices **Union map values** (`set_resource.go`, `set_sdk.go`): - Detect `RealType == "union"` on map value shapes and temporarily set `Type = "union"` before calling container code generation, so type-switch code is emitted instead of struct field access - Declare union variables with `var` instead of composite literals in `varEmptyConstructorSDKType` - Skip pointer dereference when assigning union interface values to maps ### Testing - All existing code-generator tests pass - Added unit tests for QuickSight DataSet create/update covering timestamp lists and union map values - QuickSight controller regenerates and compiles cleanly By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 5ac6c79 commit 0695fbb

7 files changed

Lines changed: 480 additions & 1215 deletions

File tree

0 commit comments

Comments
 (0)