Fix codegen: omit zero-value optional bool params
JE
7mo ago+24+24+01234567890123456789-16-16-01234567890123456789
Summary
- Add
boolto the zero-value guard pattern inclient.tmplfor query, header, and cookie params — matching the existingstring/numeric treatment - Regenerate
client.gen.go:NewListTodosRequestnow wrapscompletedinif params.Completed {, sofalse(zero value) is omitted - Update regression test to assert
completedis absent when unset, with a comment citing the BC3 API default behavior
Only ListTodosParams.Completed is affected in the current spec. The high-level TodosService.List wrapper doesn't forward Completed at all (it only forwards Status), so this only impacts direct consumers of the generated client.
Card: https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9660339476
Test plan
-
go test ./pkg/basecamp -run ZeroValueOptionalQueryParams— targeted test passes -
go test ./...— full Go suite passes -
make— all checks passed (smithy, go, ts, rb, kt, swift, conformance)
Summary by cubic
Stop serializing zero-value optional bools in generated requests. This prevents sending false by default (e.g., completed=false) so requests follow API defaults.
- Bug Fixes
- Added bool zero-value guards in
client.tmplfor query, header, and cookie params. - Regenerated
client.gen.go:NewListTodosRequestonly includescompletedwhen true. - Updated test to expect
completedomitted when unset, matching BC3 default behavior. - Scope: affects direct generated client calls only;
TodosService.Listdoes not forwardCompleted.
- Added bool zero-value guards in