Fix codegen: omit zero-value optional bool params

JE
7mo ago
+24-16

Summary

  • Add bool to the zero-value guard pattern in client.tmpl for query, header, and cookie params — matching the existing string/numeric treatment
  • Regenerate client.gen.go: NewListTodosRequest now wraps completed in if params.Completed {, so false (zero value) is omitted
  • Update regression test to assert completed is 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.tmpl for query, header, and cookie params.
    • Regenerated client.gen.go: NewListTodosRequest only includes completed when true.
    • Updated test to expect completed omitted when unset, matching BC3 default behavior.
    • Scope: affects direct generated client calls only; TodosService.List does not forward Completed.