-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Rename id parameter to commentID in IssuesService comment methods. #886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Also document which IssueComment fields need to be set in EditComment method. This should help improve clarity of the API, and reduce the chance to mix up the wrong IDs. Resolves #885.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @shurcooL!
LGTM.
@@ -118,10 +118,11 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo st | |||
} | |||
|
|||
// EditComment updates an issue comment. | |||
// A non-nil comment.Body must be provided. Other comment fields should be left nil. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An additional step we can consider doing is checking if any of the comment
fields other than Body
are set (especially ID
), and return an error with helpful text if so.
GitHub API documents that the only input field is body
, and it is required. See https://developer.github.com/v3/issues/comments/#edit-a-comment:
A breaking API change to replace IssueComment
parameter with a new IssueCommentEdit
struct containing only the Body
field is another option, but that's a breaking API change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an idea to consider, but I'm not ready to act on it yet. I'll leave it outside of the scope of this PR. If someone thinks it's worth doing, it can be sent and discussed in a followup PR.
This is a breaking API change that is a part of issue #597. It should've been applied earlier, but we missed it because the parameter was misleadingly named number rather than id or commentID. Rename the parameter to commentID to make it more clear that it's the comment ID and not the PR ID nor PR number. This should help improve clarity of the API, and reduce the chance to mix up the IDs. Also document which PullRequestComment fields need to be set in EditComment method. Similar to #886. Updates #885. Updates #597.
…888) This is a breaking API change that is a part of issue #597. It should've been applied earlier, but we missed it because the parameter was misleadingly named number rather than id or commentID. Rename the parameter to commentID to make it more clear that it's the comment ID and not the PR ID nor PR number. This should help improve clarity of the API, and reduce the chance to mix up the IDs. Also document which PullRequestComment fields need to be set in EditComment method. Similar to #886. Updates #885. Updates #597.
…oogle#886) Also document which IssueComment fields need to be set in EditComment method. This should help improve clarity of the API, and reduce the chance to mix up the issue vs comment IDs. Resolves google#885.
…oogle#888) This is a breaking API change that is a part of issue google#597. It should've been applied earlier, but we missed it because the parameter was misleadingly named number rather than id or commentID. Rename the parameter to commentID to make it more clear that it's the comment ID and not the PR ID nor PR number. This should help improve clarity of the API, and reduce the chance to mix up the IDs. Also document which PullRequestComment fields need to be set in EditComment method. Similar to google#886. Updates google#885. Updates google#597.
Also document which
IssueComment
fields need to be set inEditComment
method.This should help improve clarity of the API, and reduce the chance to mix up the issue vs comment IDs.
Resolves #885.