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

pullRequestReview.review.htmlUrl #946

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/org/kohsuke/github/GHPullRequestReview.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class GHPullRequestReview extends GHObject {
private String commit_id;
private GHPullRequestReviewState state;
private String submitted_at;
private String html_url;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ObjectMapper configuration explicitly declares snake_case strategy, but there is no single standard of field naming - I see both standard java (htmlUrl) and snake case (html_url) over the project (only fields, not getters for sure). This is confusing, IMHO it should be better to standardize it (personal preference - to java).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seregamorph "standardize to java naming" - agreed. It just hasn't been a priority. Especially since we don't have
sufficient code coverage to have high confidence in tests ensuring it is done right. PR welcome.


GHPullRequestReview wrapUp(GHPullRequest owner) {
this.owner = owner;
Expand Down Expand Up @@ -102,7 +103,7 @@ public GHPullRequestReviewState getState() {

@Override
public URL getHtmlUrl() {
return null;
return GitHubClient.parseURL(html_url);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back compatibility saved. If field is not present, the return value is still null

}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/kohsuke/github/GHEventPayloadTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ public void pull_request_review() throws Exception {
assertThat(event.getPullRequest().getNumber(), is(8));
assertThat(event.getPullRequest().getTitle(), is("Add a README description"));
assertThat(event.getPullRequest().getBody(), is("Just a few more details"));
assertThat(event.getReview().getHtmlUrl(),
hasToString("https://github.com/baxterthehacker/public-repo/pull/8#pullrequestreview-2626884"));
assertThat(event.getPullRequest().getUser().getLogin(), is("skalnik"));
assertThat(event.getPullRequest().getHead().getUser().getLogin(), is("skalnik"));
assertThat(event.getPullRequest().getHead().getRef(), is("patch-2"));
Expand Down