XAMPPRocky / octocrab

A modern, extensible GitHub API Client for Rust.
Other
1.07k stars 261 forks source link

Page fields are not filled for different handlers like Issues, PRs, ... #659

Closed MalteHerrmann closed 3 months ago

MalteHerrmann commented 3 months ago

Problem

The returned Page<...> instances from e.g. the ReleasesHandler or PullRequestHandler have pretty much all of their fields set to None values, even though the objects like releases or pull requests could be successfully retrieved. Since there were items returned, I would expect the next, and first fields to work as well as the totalCount.

image

How To Reproduce

The following test showcases this.

    #[tokio::test]
    async fn test_get_release() {
        let oc = octocrab::instance();
        let repos = oc.repos("evmos", "evmos");
        let rls_list = repos.releases().list().send().await.unwrap();
        assert!(rls_list.items.len() > 0);          // <--- this is passing
        assert!(rls_list.total_count.unwrap() > 0)  // <--- total count has a None value returned
    }
M0dEx commented 3 months ago

I am having the same problem with the RepoHandler.

XAMPPRocky commented 3 months ago

Thank you for your issue! I don't currently have time to investigate a fix myself but I'm happy to review a PR addressing the issue. 🙂

MalteHerrmann commented 3 months ago

I was looking into a potential "fix" and realised that I was just misunderstanding the purpose of these fields. It works just fine according to the behavior of the GitHub API - for reference if anyone else is confused by this:

These were the assumptions I did not know of - in other cases the fields are filled as expected.