Skip to content

refactor!: Rename EditLabel to UpdateLabel, Split Label into CreateLabelRequest & UpdateLabelRequest and pass by value - #4400

Merged
gmlewis merged 3 commits into
google:masterfrom
jvm986:refactor/3644-issues-labels-value-params
Jul 22, 2026
Merged

refactor!: Rename EditLabel to UpdateLabel, Split Label into CreateLabelRequest & UpdateLabelRequest and pass by value#4400
gmlewis merged 3 commits into
google:masterfrom
jvm986:refactor/3644-issues-labels-value-params

Conversation

@jvm986

@jvm986jvm986 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Continues the request-body-by-value work in #3644, for IssuesService.Label.

BREAKING CHANGE: IssuesService.CreateLabel now takes a CreateLabelRequest by value (with a required non-pointer Name). IssuesService.EditLabel renamed to UpdateLabel, taking an UpdateLabelRequest by value instead of a *Label (with all fields optional).

Notes

  • The update request takes new_name, not name which appears to have been a latent bug.

cc @JamBalaya56562 flagging for #3644 coordination

…est` and pass by value
Towards google#3644.
BREAKING CHANGE: `IssuesService.CreateLabel` now takes a `CreateLabelRequest` by value (with a required non-pointer `Name`), and `IssuesService.EditLabel` takes an `UpdateLabelRequest` by value instead of a `*Label`.
The update endpoint expects the rename field as `new_name`, not `name`.
@jvm986jvm986 changed the title refactor!: Split Label into CreateLabelRequest & UpdateLabelRequest and pass by valuerefactor!: Rename EditLabel to UpdateLabel, Split Label into CreateLabelRequest & UpdateLabelRequest and pass by valueJul 22, 2026
Towards: google#3644
BREAKING CHANGE: `Issues.EditLabel` renamed to `UpdateLabel`

@alexandearalexandear left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please also fix the Label struct according to the schema.

Comment threadgithub/issues_labels.go Outdated
Comment on lines +28 to +36
// CreateLabelRequest represents a request to create a label.
type CreateLabelRequest struct {
Name string `json:"name"`
Color *string `json:"color,omitempty"`
Description *string `json:"description,omitempty"`
}

// UpdateLabelRequest represents a request to update a label.
type UpdateLabelRequest struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CreateLabelRequest, UpdateLabelRequest are too broad. Let's add a prefix:

Suggested change
// CreateLabelRequest represents a request to create a label.
typeCreateLabelRequeststruct {
Namestring`json:"name"`
Color*string`json:"color,omitempty"`
Description*string`json:"description,omitempty"`
}
// UpdateLabelRequest represents a request to update a label.
typeUpdateLabelRequeststruct {
// IssueCreateLabelRequest represents a request to create a label.
typeCreateLabelRequeststruct {
Namestring`json:"name"`
Color*string`json:"color,omitempty"`
Description*string`json:"description,omitempty"`
}
// IssueUpdateLabelRequest represents a request to update a label.
typeUpdateLabelRequeststruct {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I left the verb at the start, as that seems to align more with the rest of the repository. Always happy to be challenged here.

@gmlewisgmlewis 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 Jul 22, 2026
…struct with schema
Towards google#3644.
BREAKING CHANGE:
- Rename `CreateLabelRequest`/`UpdateLabelRequest` to `CreateIssueLabelRequest`/`UpdateIssueLabelReques ` (verb-first, consistent with `CreateIssueRequest`).
- Align the `Label` response struct with the schema: the always-present fields (`id`, `url`, `name`, `color`, `default`, `node_id`) are now non-pointer, while nullable `description` stays `*string`.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API ChangePR will require a bump to the major version num in next release. Look here to see the change(s).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@jvm986@alexandear@gmlewis