android / android/codelab-android-paging
[BUG] The incorrect splicing of the GitHub API results in empty data from the request.
- Dominant language
- Kotlin
- Stars
- 509
- Forks
- 268
- PR merge metrics
- No merged PRs in 30d
Description
Hey there, I recently tried the demo [codelab-android-paging/tree/main/advanced/start](https://github.com/android/codelab-android-paging/tree/main/advanced/start), and found the list always empty, according to the [latest official document](https://docs.github.com/en/rest/search/search?apiVersion=2022-11-28#search-repositories) the reason is the `apiQuery` used in both start and end project missed a `+` between `query` and `IN_QUALIFIER`:
as in the start project:
IN_QUALIFIER:
https://github.com/android/codelab-android-paging/blob/d1f28e0caf76e429c31b063163cd0ad963b549c9/advanced/start/app/src/main/java/com/example/android/codelabs/paging/api/GithubService.kt#L27
`apiQuery`:
https://github.com/android/codelab-android-paging/blob/d1f28e0caf76e429c31b063163cd0ad963b549c9/advanced/start/app/src/main/java/com/example/android/codelabs/paging/data/GithubRepository.kt#L80
Same code in [codelab-android-paging/tree/main/advanced/end](https://github.com/android/codelab-android-paging/tree/main/advanced/end)
https://github.com/android/codelab-android-paging/blob/d1f28e0caf76e429c31b063163cd0ad963b549c9/advanced/end/app/src/main/java/com/example/android/codelabs/paging/api/GithubService.kt#L27
https://github.com/android/codelab-android-paging/blob/d1f28e0caf76e429c31b063163cd0ad963b549c9/advanced/end/app/src/main/java/com/example/android/codelabs/paging/data/GithubRemoteMediator.kt#L85
if we input a `query` as "Android", the final network request URL will be "https://api.github.com/search/repositories?sort=stars&q=Androidin%3Aname%2Cdescription&page=1&per_page=30"
and the result:
```
{
"total_count": 0,
"incomplete_results": false,
"items": [
]
}
```
after we add a `+` :
"https://api.github.com/search/repositories?sort=stars&q=Android%2Bin%3Aname%2Cdescription&page=1&per_page=30"
and the result:
```
{
"total_count": 64,
"incomplete_results": false,
"items": [
...
]
}
```
Contributor guide
Research direction
Start with advanced/start/app/src/main/java/com/example/android/codelabs/paging/data/GithubRepository.kt and advanced/end/app/src/main/java/com/example/android/codelabs/paging/data/GithubRemoteMediator.kt, then compare their apiQuery construction with IN_QUALIFIER in the corresponding GithubService.kt files. Verify that a query such as “Android” produces the documented GitHub search URL and returns repository items in both projects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, kotlin
- Domain
- api, mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100