Skip to content

fix: use *string for clearable fields on update endpoints - #34

Merged
simonnordberg merged 1 commit into
mainfrom
fix/clearable-string-fields
Oct 14, 2026
Merged

simonnordberg merged 1 commit into
mainfrom
fix/clearable-string-fields

Conversation

@simonnordberg

Copy link
Copy Markdown
Contributor

Summary

  • buildBody skips zero-value fields, which meant users could never clear a string field (description, website, body, etc.) via the CLI
  • Booleans and ints already used pointer types with Cobra's Changed() pattern; this extends it to *string
  • ~16 fields across update/PATCH endpoints changed from string to *string
  • Code generator (cmd/gen) now handles *string alongside *bool/*int
  • Create endpoints unchanged (empty = not set, which is correct)

Affected tools: update_repo, update_issue, update_pull_request, update_release, edit_label, update_hook, update_org_hook, update_branch_protection

Test plan

  • go build ./... passes
  • go test ./... passes
  • go generate ./... is idempotent
  • New test TestBuildBodyOptionalStringSendsExplicitEmpty verifies non-nil *string("") is sent, nil *string is excluded

buildBody skips zero-value fields, which meant users could never clear
a string field (description, website, body, etc.) via the CLI. Booleans
and ints already used pointer types with Cobra's Changed() pattern.

Extend the same pattern to strings: ~16 fields on update/PATCH endpoints
changed from string to *string. The code generator now handles *string
alongside *bool/*int. Create endpoints are unchanged (empty = not set).
@simonnordberg
simonnordberg merged commit a68bfb2 into main Oct 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant