refactor!: Split RepositoryComment request bodies and pass by value - #4496
Open
JamBalaya56562 wants to merge 2 commits into
Open
refactor!: Split RepositoryComment request bodies and pass by value#4496JamBalaya56562 wants to merge 2 commits into
RepositoryComment request bodies and pass by value#4496JamBalaya56562 wants to merge 2 commits into
Conversation
RepositoriesService.CreateComment and UpdateComment reused the
12-field RepositoryComment response type as their request bodies. The
two endpoints accept different fields (create: body, path, position,
line; update: body only), so introduce dedicated
CreateCommitCommentRequest and UpdateCommitCommentRequest types, pass
them by value, and drop RepositoryComment from the paramcheck
allowlist. Also align the {comment_id} parameter name to commentID
across GetComment, UpdateComment, and DeleteComment.
BREAKING CHANGE: `RepositoriesService.CreateComment` now takes `CreateCommitCommentRequest` and `RepositoriesService.UpdateComment` takes `UpdateCommitCommentRequest`, both passed by value instead of `*RepositoryComment`.
Updates google#3644.
The commit-comment response schema includes author_association and line, which were missing from the struct.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4496 +/- ##
=======================================
Coverage 98.52% 98.52%
=======================================
Files 195 195
Lines 17745 17745
=======================================
Hits 17484 17484
Misses 261 261 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
gmlewis
approved these changes
Aug 29, 2026
gmlewis
left a comment
Collaborator
There was a problem hiding this comment.
Thank you, @JamBalaya56562!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continues the request-body-by-value work in #3644 — the commit-comments counterpart of #4444 (
IssueComment, issues) and #4493 (PullRequestComment, pulls), completing the comment-endpoint family.Commit 1 (
refactor!:) —RepositoriesService.CreateCommentandUpdateCommentreused the 12-fieldRepositoryCommentresponse type as their request bodies. Per the create / update docs the two request schemas differ, so this splits them into dedicated types (same shape as #4493):bodypathpositionlineBoth methods now take these by value (
Bodyrequired → non-pointer, noomitempty), andRepositoryCommentis removed from theparamcheckallowlist in.golangci.yml. No method renames are needed —Create/Updatealready match the docs operation names. Alongside:// User-mutable fields/// User-initialized fieldsmarkers onRepositoryCommentare dropped andBody's tag normalized tojson:"body,omitempty", making it a plain response type likeIssueComment/PullRequestComment;{comment_id}parameter is namedcommentIDconsistently acrossGetComment/UpdateComment/DeleteComment(matching the issues/pulls comment files);linecreate parameter, which the old shared type could not send at all.Commit 2 (
feat:, non-breaking) — cross-checking the full commit-comment response schema against the struct turned up two missing fields, added here with regenerated accessors:AuthorAssociationandLine.BREAKING CHANGE:
RepositoriesService.CreateCommentnow takesCreateCommitCommentRequestandRepositoriesService.UpdateCommenttakesUpdateCommitCommentRequest, both passed by value instead of*RepositoryComment.Verified with
go build ./...,gofmt,go vet -tags integration ./test/integration/, the full./github/test suite (allrepos_comments.gomethods at 100% coverage), generator idempotency, andcustom-gcl(0 issues with the allowlist entry removed).Updates #3644.
cc @jvm986