Skip to content
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

Rename id parameter to commentID in IssuesService comment methods. #886

Merged
merged 1 commit into from
Mar 29, 2018

Conversation

dmitshur
Copy link
Member

@dmitshur dmitshur commented Mar 29, 2018

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 #885.

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.
@googlebot googlebot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label Mar 29, 2018
Copy link
Collaborator

@gmlewis gmlewis left a 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.
Copy link
Member Author

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:

image

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.

Copy link
Member Author

@dmitshur dmitshur Mar 29, 2018

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.

@dmitshur dmitshur merged commit 4377977 into master Mar 29, 2018
@dmitshur dmitshur deleted the IssuesService-commentID branch March 29, 2018 18:54
dmitshur added a commit that referenced this pull request Mar 30, 2018
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.
dmitshur added a commit that referenced this pull request Apr 2, 2018
…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.
nbareil pushed a commit to nbareil/go-github that referenced this pull request May 1, 2018
…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.
nbareil pushed a commit to nbareil/go-github that referenced this pull request May 1, 2018
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indication that the PR author has signed a Google Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants