-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix InReplyToID JSON tag for PullRequestComment #950
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
Fix InReplyToID JSON tag for PullRequestComment #950
Conversation
I'm looking at the API for For What if we were to split the current func (s *PullRequestsService) CreateComment(ctx context.Context, owner string, repo string, number int,
comment *PullRequestComment) (*PullRequestComment, *Response, error) { ... }
func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner string, repo string, number int, body string, commentID int64) (*PullRequestComment, *Response, error) { ... } That way, we don't break the current API, but add a simpler method to handle the alternate case? (I was first going to create a |
Thanks for the feedback, I've updated the PR based on your recommendation. I've updated the original |
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, @emersonwood!
I like this very much!
LGTM.
@juliaferraioli - if you have time to review this, that would be great!
Otherwise, awaiting second LGTM before merging.
TL;DR: The prior version was not populating PullRequestComment.InReplyTo
due to a typo in github/pulls_comments.go
which this fixes (but we chose not to change the InReplyTo
field name as to not break the API... although one could argue that it was already broken and we should change it now to InReplyToID
... thoughts, @juliaferraioli?). Also, the alternative way to create a reply comment was not previously supported but now is.
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.
I agree with @gmlewis that this is the simpler change, and not breaking the API (even with the caveat that it was already broken) makes the most sense.
LGTM!
Thank you, @juliaferraioli! |
Fixes #948.
The JSON tag mismatches the one returned from the API, so the value is always encoded as nil.
Relevant docs: https://developer.github.com/v3/pulls/comments/#get-a-single-comment
Also have to use an alias since the JSON tag is different between getting a comment and creating a comment.
I'd be keen to see if there's a more elegant way to do this.