Commit 35caa24
authored
Fix incorrect shape name in bad default filtering (#671)
Issue #, if available:
Description of changes:
# Fix incorrect shape name in bad default filtering
## Issue
The **EMR Serverless** controller was failing to build with type errors like:
> `cannot use &f9valiter.WorkerCount (value of type **int64) as *int64 value in assignment`
---
## Root Cause
**AWS SDK Go v2** has a `RemoveDefaults` customization that removes default values from certain shapes where the default is incompatible with the shape's range constraints. This makes those fields nillable (pointers) in the generated SDK code.
The **ACK code generator** had the wrong shape name in its `BadDefaultsAssignment` map:
* **Before:** `"WorkerCounts": true` (the Smithy shape name)
* **After:** `"WorkerCount": true` (the actual member name used in Go structs)
**Reference:** [AWS SDK Go v2 Source](https://github.com/aws/aws-sdk-go-v2/blob/dfcf25b6d15674848f71bd7e5ee8ed22b115c6a2/codegen/sdk-codegen/aws-models/emr-serverless.json#L2111)
---
## Changes
* **`pkg/apiv2/remove_defaults.go`**: Fixed the member name from `WorkerCounts` to `WorkerCount` to match the actual struct field name in the SDK.
* **`pkg/generate/code/set_sdk.go`**: Fixed map value type generation to use the original shape name for SDK struct types when available.
---
## Testing
* EMR Serverless controller now builds successfully.
* Generated code correctly handles `WorkerCount` as a pointer type (*int64).
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.1 parent 1854562 commit 35caa24
6 files changed
Lines changed: 8543 additions & 1060 deletions
File tree
- pkg
- apiv2
- generate/code
- testdata
- codegen/sdk-codegen/aws-models
- models/apis/emr-serverless/0000-00-00
0 commit comments