Skip to content

refactor!: Rename EditMilestone to UpdateMilestone, split Milestone request bodies into CreateMilestoneRequest and UpdateMilestoneRequest, and pass by value - #4438

Open
JamBalaya56562 wants to merge 1 commit into
google:masterfrom
JamBalaya56562:refactor/3644-milestone-value-params
Open

refactor!: Rename EditMilestone to UpdateMilestone, split Milestone request bodies into CreateMilestoneRequest and UpdateMilestoneRequest, and pass by value#4438
JamBalaya56562 wants to merge 1 commit into
google:masterfrom
JamBalaya56562:refactor/3644-milestone-value-params

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

Continues the request-body-by-value work in #3644, this time for the milestone endpoints on IssuesService.

CreateMilestone and EditMilestone reused the 16-field Milestone response type as their request bodies, but per the docs the endpoints accept only four parameters — the other twelve fields (url, number, creator, open_issues, created_at, …) are server-generated. And the two schemas differ:

Field Create (POST) Update (PATCH)
title required optional
state optional optional
description optional optional
due_on optional optional

So this splits the request body into two dedicated types, following the same approach as #4382, #4401 and the Issues-service splits in #4396/#4400:

  • CreateMilestoneRequestTitle is a non-pointer string (no omitempty) since it's required; the rest stay pointers.
  • UpdateMilestoneRequest — every field is optional, so all stay pointers.

EditMilestone is renamed to UpdateMilestone to match the docs operation name, Update a milestone (same convention as EditLabelUpdateLabel in #4400). Both methods now take their body by value, and Milestone is removed from the body-allowed-pointer-types allowlist. The Milestone response type itself is unchanged.

Verified with go build ./..., go vet -tags integration ./test/integration/, gofmt, the full ./github/ test suite (both methods and the eight generated accessors at 100%), and custom-gcl (no paramcheck findings after removing the allowlist entry).

Updates #3644

BREAKING CHANGE: IssuesService.CreateMilestone now takes a new CreateMilestoneRequest (with non-pointer Title) by value, and IssuesService.EditMilestone is renamed to UpdateMilestone and takes a new UpdateMilestoneRequest by value, instead of *Milestone.

cc @jvm986 — this one is in the Issues service, which you'd been working through; since it's been a couple of weeks I picked up the next item, but happy to coordinate again whenever you resume.

…one` request bodies into `CreateMilestoneRequest` and `UpdateMilestoneRequest`, and pass by value

CreateMilestone and EditMilestone reused the 16-field Milestone response
type as their request bodies, but the endpoints accept only title, state,
description and due_on, and their schemas differ: title is required on
create and optional on update. The new request types model each schema
exactly (non-pointer Title on create) and are passed by value.

EditMilestone is renamed to UpdateMilestone to match the docs operation
name. The Milestone response type stays unchanged, and its entry is removed
from the .golangci.yml allowlist.

BREAKING CHANGE: IssuesService.CreateMilestone now takes a new CreateMilestoneRequest (with non-pointer Title) by value, and IssuesService.EditMilestone is renamed to UpdateMilestone and takes a new UpdateMilestoneRequest by value, instead of *Milestone.
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Aug 6, 2026

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @JamBalaya56562!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @Not-Dhananjay-Mishra

@gmlewis

gmlewis commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Closing and reopening to force all the GitHub Actions workflows to fire properly after today's GitHub outage.

@gmlewis gmlewis closed this Aug 7, 2026
@gmlewis gmlewis reopened this Aug 7, 2026
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.55%. Comparing base (3f04c1d) to head (65257ec).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4438   +/-   ##
=======================================
  Coverage   97.55%   97.55%           
=======================================
  Files         194      194           
  Lines       19892    19892           
=======================================
  Hits        19406    19406           
  Misses        268      268           
  Partials      218      218           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants