Skip to content

Commit 606ddb1

Browse files
authored
bug: Check run id can be bigger than MAX_INT (#143)
* bug: Check Suite id can be bigger than MAX_INT Not sure if it can be bigger than long either, but this does not make things worse and solves the issue I ran into. * clean: use dashes over underscores in check-suites-response.json for consistency Every other file in the same folder uses dashes, lets go with them.
1 parent d82b45e commit 606ddb1

File tree

5 files changed

+198
-3
lines changed

5 files changed

+198
-3
lines changed

src/main/java/com/spotify/github/v3/checks/CheckSuite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public interface CheckSuite {
3636
*
3737
* @return the integer
3838
*/
39-
Integer id();
39+
Long id();
4040

4141
Optional<App> app();
4242

src/test/java/com/spotify/github/v3/checks/CheckSuiteTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,22 @@ public void testDeserialization() throws IOException {
3737
// sample payload from https://docs.github.com/en/rest/checks/suites#list-check-suites-for-a-git-reference
3838
String fixture =
3939
Resources.toString(
40-
getResource(this.getClass(), "check_suites_response.json"), defaultCharset());
40+
getResource(this.getClass(), "check-suites-response.json"), defaultCharset());
4141
final CheckSuiteResponseList checkSuiteResponseList = Json.create().fromJson(fixture, CheckSuiteResponseList.class);
4242
assertThat(checkSuiteResponseList.checkSuites().get(0).id(), is(5));
4343
assertThat(checkSuiteResponseList.checkSuites().get(0).app().get().slug().get(), is("octoapp"));
4444
}
4545

46+
47+
@Test
48+
public void testDeserializationWithLongId() throws IOException {
49+
// sample payload from https://docs.github.com/en/rest/checks/suites#list-check-suites-for-a-git-reference
50+
String fixture =
51+
Resources.toString(
52+
getResource(this.getClass(), "check-suites-response-long-id.json"), defaultCharset());
53+
final CheckSuiteResponseList checkSuiteResponseList = Json.create().fromJson(fixture, CheckSuiteResponseList.class);
54+
assertThat(checkSuiteResponseList.checkSuites().get(0).id(), is(14707641936L));
55+
assertThat(checkSuiteResponseList.checkSuites().get(0).app().get().slug().get(), is("octoapp"));
56+
}
57+
4658
}

src/test/java/com/spotify/github/v3/clients/GitHubClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public void testGetCheckSuites() throws Throwable {
190190
.code(200)
191191
.body(
192192
ResponseBody.create(
193-
MediaType.get("application/json"), getFixture("../checks/check_suites_response.json")))
193+
MediaType.get("application/json"), getFixture("../checks/check-suites-response.json")))
194194
.message("")
195195
.protocol(Protocol.HTTP_1_1)
196196
.request(new Request.Builder().url("http://localhost/").build())
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
{
2+
"total_count": 1,
3+
"check_suites": [
4+
{
5+
"id": 14707641936,
6+
"node_id": "MDEwOkNoZWNrU3VpdGU1",
7+
"head_branch": "master",
8+
"head_sha": "d6fde92930d4715a2b49857d24b940956b26d2d3",
9+
"status": "completed",
10+
"conclusion": "neutral",
11+
"url": "https://api.github.com/repos/github/hello-world/check-suites/5",
12+
"before": "146e867f55c26428e5f9fade55a9bbf5e95a7912",
13+
"after": "d6fde92930d4715a2b49857d24b940956b26d2d3",
14+
"pull_requests": [],
15+
"app": {
16+
"id": 1,
17+
"slug": "octoapp",
18+
"node_id": "MDExOkludGVncmF0aW9uMQ==",
19+
"owner": {
20+
"login": "github",
21+
"id": 1,
22+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
23+
"url": "https://api.github.com/orgs/github",
24+
"repos_url": "https://api.github.com/orgs/github/repos",
25+
"events_url": "https://api.github.com/orgs/github/events",
26+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
27+
"gravatar_id": "",
28+
"html_url": "https://github.com/octocat",
29+
"followers_url": "https://api.github.com/users/octocat/followers",
30+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
31+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
32+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
33+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
34+
"organizations_url": "https://api.github.com/users/octocat/orgs",
35+
"received_events_url": "https://api.github.com/users/octocat/received_events",
36+
"type": "User",
37+
"site_admin": true
38+
},
39+
"name": "Octocat App",
40+
"description": "",
41+
"external_url": "https://example.com",
42+
"html_url": "https://github.com/apps/octoapp",
43+
"created_at": "2017-07-08T16:18:44-04:00",
44+
"updated_at": "2017-07-08T16:18:44-04:00",
45+
"permissions": {
46+
"metadata": "read",
47+
"contents": "read",
48+
"issues": "write",
49+
"single_file": "write"
50+
},
51+
"events": [
52+
"push",
53+
"pull_request"
54+
]
55+
},
56+
"repository": {
57+
"id": 1296269,
58+
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
59+
"name": "Hello-World",
60+
"full_name": "octocat/Hello-World",
61+
"owner": {
62+
"login": "octocat",
63+
"id": 1,
64+
"node_id": "MDQ6VXNlcjE=",
65+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
66+
"gravatar_id": "",
67+
"url": "https://api.github.com/users/octocat",
68+
"html_url": "https://github.com/octocat",
69+
"followers_url": "https://api.github.com/users/octocat/followers",
70+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
71+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
72+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
73+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
74+
"organizations_url": "https://api.github.com/users/octocat/orgs",
75+
"repos_url": "https://api.github.com/users/octocat/repos",
76+
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
77+
"received_events_url": "https://api.github.com/users/octocat/received_events",
78+
"type": "User",
79+
"site_admin": false
80+
},
81+
"private": false,
82+
"html_url": "https://github.com/octocat/Hello-World",
83+
"description": "This your first repo!",
84+
"fork": false,
85+
"url": "https://api.github.com/repos/octocat/Hello-World",
86+
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
87+
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
88+
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
89+
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
90+
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
91+
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
92+
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
93+
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
94+
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
95+
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
96+
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
97+
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
98+
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
99+
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
100+
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
101+
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
102+
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
103+
"git_url": "git:github.com/octocat/Hello-World.git",
104+
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
105+
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
106+
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
107+
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
108+
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
109+
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
110+
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
111+
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
112+
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
113+
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
114+
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
115+
"ssh_url": "[email protected]:octocat/Hello-World.git",
116+
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
117+
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
118+
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
119+
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
120+
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
121+
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
122+
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
123+
"clone_url": "https://github.com/octocat/Hello-World.git",
124+
"mirror_url": "git:git.example.com/octocat/Hello-World",
125+
"hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks",
126+
"svn_url": "https://svn.github.com/octocat/Hello-World",
127+
"homepage": "https://github.com",
128+
"language": null,
129+
"forks_count": 9,
130+
"stargazers_count": 80,
131+
"watchers_count": 80,
132+
"size": 108,
133+
"default_branch": "master",
134+
"open_issues_count": 0,
135+
"is_template": true,
136+
"topics": [
137+
"octocat",
138+
"atom",
139+
"electron",
140+
"api"
141+
],
142+
"has_issues": true,
143+
"has_projects": true,
144+
"has_wiki": true,
145+
"has_pages": false,
146+
"has_downloads": true,
147+
"archived": false,
148+
"disabled": false,
149+
"visibility": "public",
150+
"pushed_at": "2011-01-26T19:06:43Z",
151+
"created_at": "2011-01-26T19:01:12Z",
152+
"updated_at": "2011-01-26T19:14:43Z",
153+
"permissions": {
154+
"admin": false,
155+
"push": false,
156+
"pull": true
157+
},
158+
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
159+
"delete_branch_on_merge": true,
160+
"subscribers_count": 42,
161+
"network_count": 0
162+
},
163+
"created_at": "2011-01-26T19:01:12Z",
164+
"updated_at": "2011-01-26T19:14:43Z",
165+
"head_commit": {
166+
"id": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
167+
"tree_id": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
168+
"message": "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.",
169+
"timestamp": "2016-10-10T00:00:00Z",
170+
"author": {
171+
"name": "The Octocat",
172+
"email": "[email protected]"
173+
},
174+
"committer": {
175+
"name": "The Octocat",
176+
"email": "[email protected]"
177+
}
178+
},
179+
"latest_check_runs_count": 1,
180+
"check_runs_url": "https://api.github.com/repos/octocat/Hello-World/check-suites/5/check-runs"
181+
}
182+
]
183+
}
File renamed without changes.

0 commit comments

Comments
 (0)