Repository navigation
Add the AuthorAssociation field to IssueComment and PullRequestComment. - #892
Conversation
|
When we encounter inconsistencies in GitHub API v3 behavior vs its documentation, we generally try to report it to GitHub. At the very top of https://developer.github.com/v3/, they say:
That way, they can fix the documentation (if it was wrong), fix the behavior (if the documentation was accurate), and confirm to us whether something is considered official and can be relied on. @dsymonds Would you like to contact them about it and let us know their response? Aside from this feature being undocumented (in v3 API docs), the change looks good. |
|
I can contact them, but I suspect they'll just give some uninteresting response about how their v3 API is the past and v4 is the future, and not actually get anywhere. It's not that their documentation is wrong, per se, only incomplete, and given that almost all of their v3 API documentation is sorely lacking in completeness I'm not surprised to find the occasional missing info. |
|
From past experience, they tend to be very helpful, even in a situation like this. I think it’s worth a shot. If there’s no response for a long time, then we can consider moving forward anyway. But if they confirm those fields are meant to be included in v3 and are just missing in docs, merging this will become much easier. Also, reporting inconsistencies generally leads to there being fewer of them, and this library is easier to maintain when it deviates less from the GitHub API docs. Thanks for doing this. |
|
OK, I'll send them a note and report back. |
|
Looks like you were right, cool. "Thanks for reaching out. That field is indeed meant to be in the response and the docs need to be updated. I've passed this along to the docs team so that they can look into this. " |
dmitshur
left a comment
There was a problem hiding this comment.
Great to hear!
I've confirmed the author_association field exists in the real GitHub API v3 response for both the objects that these 2 structs map to. So that part has my LGTM.
I have one more comment about potentially documenting the possible AuthorAssociation values, see inline comment and let me know what you think.
| Reactions *Reactions `json:"reactions,omitempty"` | ||
| CreatedAt *time.Time `json:"created_at,omitempty"` | ||
| UpdatedAt *time.Time `json:"updated_at,omitempty"` | ||
| AuthorAssociation *string `json:"author_association,omitempty"` |
There was a problem hiding this comment.
It might be helpful to document the possible values, ala:
AuthorAssociation *string `json:"author_association,omitempty"` // Possible values are: "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE".We do this in some other places, e.g.:
go-github/github/event_types.go
Lines 330 to 332 in 89a446e
The reason to do so is because GitHub API v3 docs currently don't list the possible values, so someone looking at go-github API docs will not be able to tell what the possible value for AuthorAssociation field are, other than by trial and error. That doesn't make for a friendly API.
I think it'd be okay to leave this out when GitHub updates their API v3 docs to mention the possible values for this field. So an alternative could be to hold merging this PR until then.
What do you think is better?
There was a problem hiding this comment.
Well, I want to actually be able to use this field in my code, so I'd prefer to get this PR merged, and then return to add more documentation whenever GitHub gets to updating their docs.
There was a problem hiding this comment.
Note also that the GitHub docs generally do a poor job of describing possible return values. They only seem to document request parameters.
There was a problem hiding this comment.
Sorry, I wasn't clear. I was going to add the sample values in this PR, even though they aren't in any docs.
There was a problem hiding this comment.
even though they aren't in any docs.
I got the list of values from the v4 API docs (https://developer.github.com/v4/enum/commentauthorassociation/). The author_association values I saw when I tried a few sample queries against the v3 API matched that, so I expect the rest should match too.
It's undocumented in the v3 API, but is present in the v4 API, and is indeed returned in v3 API requests.
|
PTAL |
…oogle#892) It's currently undocumented in GitHub API v3 docs, but is present in API v4, and is also returned in API v3 responses. GitHub support have confirmed that the field is meant to be included in GitHub API v3 responses, and the documentation will be updated. It's documented in GitHub API v4 docs at https://developer.github.com/v4/reference/object/issuecomment/#fields and https://developer.github.com/v4/reference/enum/commentauthorassociation/.
…oogle#892) It's currently undocumented in GitHub API v3 docs, but is present in API v4, and is also returned in API v3 responses. GitHub support have confirmed that the field is meant to be included in GitHub API v3 responses, and the documentation will be updated. It's documented in GitHub API v4 docs at https://developer.github.com/v4/reference/object/issuecomment/#fields and https://developer.github.com/v4/reference/enum/commentauthorassociation/.
It's undocumented in the v3 API, but is present in the v4 API, and is
indeed returned in v3 API requests.