XAMPPRocky / octocrab

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

missing field `name` error in release API #344

Closed koyashiro closed 1 year ago

koyashiro commented 1 year ago

The following error occurs when executing the following code in v0.20.0.

Serde Error: missing field `name`

This error is not reproduced in v0.19.0.

Cargo.toml:

[package]
name = "foo"
version = "0.1.0"
edition = "2021"

[dependencies]
octocrab = "0.20.0"
tokio = { version = "1.27.0", features = ["full"] }

src/main.rs:

#[tokio::main]
async fn main() {
    let result = octocrab::instance()
        .repos("vrchat-community", "template-package")
        .releases()
        .list()
        .send()
        .await;
    match result {
        Ok(releases) => println!("{releases:?}"),
        Err(error) => eprintln!("{error}"),
    }
}

https://api.github.com/repos/vrchat-community/template-package/releases

log: ```console root@e304ea9ab1b6:~/foo# rustc --version rustc 1.68.2 (9eb3afe9e 2023-03-27) root@e304ea9ab1b6:~/foo# cargo --version cargo 1.68.2 (6feb7c9cf 2023-03-26) root@e304ea9ab1b6:~/foo# cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.07s Running `target/debug/foo` Serde Error: missing field `name` Found at 0 ::generate::hb49cf2074d99f9ea /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/snafu-0.7.4/src/backtrace_shim.rs:15 snafu::GenerateImplicitData::generate_with_source::h66c49f30e183fc51 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/snafu-0.7.4/src/lib.rs:1152 1 >::into_error::h6b0214624170ad3c /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/octocrab-0.20.0/src/error.rs:23 2 as snafu::ResultExt>::context::h6e1b58a4f8a0ea1b /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/snafu-0.7.4/src/lib.rs:697 3 as octocrab::from_response::FromResponse>::from_response::{{closure}}::h73aa857d94b5056f /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/octocrab-0.20.0/src/page.rs:187 4 as core::future::future::Future>::poll::h818efcc732e1bf41 /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/future/future.rs:125 5 octocrab::Octocrab::get_with_headers::{{closure}}::hce6a067af3d341d4 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/octocrab-0.20.0/src/lib.rs:1128 6 octocrab::Octocrab::get::{{closure}}::hdfd2254dec5361c8 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/octocrab-0.20.0/src/lib.rs:1073 7 octocrab::api::repos::releases::ListReleasesBuilder::send::{{closure}}::h643fe5e936ae689f /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/octocrab-0.20.0/src/api/repos/releases.rs:246 8 foo::main::{{closure}}::ha386e255f4bff82e /root/foo/src/main.rs:8 9 tokio::runtime::park::CachedParkThread::block_on::{{closure}}::h464a7f6b5c7df807 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/park.rs:283 10 tokio::runtime::coop::with_budget::ha8949ba629c5ed25 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/coop.rs:107 tokio::runtime::coop::budget::hbda9e9586cb0bcbd /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/coop.rs:73 tokio::runtime::park::CachedParkThread::block_on::hdc330236f78617ee /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/park.rs:283 11 tokio::runtime::context::BlockingRegionGuard::block_on::h691993966ad8e354 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/context.rs:315 12 tokio::runtime::scheduler::multi_thread::MultiThread::block_on::h9fd5d44c32c3b16b /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/scheduler/multi_thread/mod.rs:66 13 tokio::runtime::runtime::Runtime::block_on::h13564161c8428062 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/runtime.rs:304 14 foo::main::h7c7f4b88390e1aac /root/foo/src/main.rs:9 15 core::ops::function::FnOnce::call_once::h02344d62e7312657 /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/ops/function.rs:250 16 std::sys_common::backtrace::__rust_begin_short_backtrace::h3d752769bacdcbc8 /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys_common/backtrace.rs:121 17 std::rt::lang_start::{{closure}}::h924979a40590cded /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/rt.rs:166 18 core::ops::function::impls:: for &F>::call_once::h203afb3af230319a /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/ops/function.rs:287 std::panicking::try::do_call::hf68e87013b70f3c5 /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:483 std::panicking::try::h040ea8f298390ba2 /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:447 std::panic::catch_unwind::h1e17b198887a05fa /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panic.rs:140 std::rt::lang_start_internal::{{closure}}::hfb902d8927e51b86 /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/rt.rs:148 std::panicking::try::do_call::h354e6eb41f2e7d42 /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:483 std::panicking::try::h4a39749cd018228c /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:447 std::panic::catch_unwind::h30bce83b8de61cca /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panic.rs:140 std::rt::lang_start_internal::h8f7e70b1a2558118 /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/rt.rs:148 19 std::rt::lang_start::h1bc9a9786f8b3443 /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/rt.rs:165 20 main 21 __libc_start_main 22 _start ```
L1ghtman2k commented 1 year ago

curl request curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer <YOUR-TOKEN>" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/vrchat-community/template-package/releases:

[
  {
    "url": "https://api.github.com/repos/vrchat-community/template-package/releases/76430207",
    "assets_url": "https://api.github.com/repos/vrchat-community/template-package/releases/76430207/assets",
    "upload_url": "https://uploads.github.com/repos/vrchat-community/template-package/releases/76430207/assets{?name,label}",
    "html_url": "https://github.com/vrchat-community/template-package/releases/tag/0.0.3",
    "id": 76430207,
    "author": {
      "login": "github-actions[bot]",
      "id": 41898282,
      "node_id": "MDM6Qm90NDE4OTgyODI=",
      "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/github-actions%5Bbot%5D",
      "html_url": "https://github.com/apps/github-actions",
      "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
      "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
      "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
      "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
      "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
      "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
      "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
      "type": "Bot",
      "site_admin": false
    },
    "node_id": "RE_kwDOH7dDGs4Ejjt_",
    "tag_name": "0.0.3",
    "target_commitish": "main",
    "name": "0.0.3",
    "draft": false,
    "prerelease": false,
    "created_at": "2022-09-06T22:46:57Z",
    "published_at": "2022-09-06T22:47:12Z",
    "assets": [
      {
        "url": "https://api.github.com/repos/vrchat-community/template-package/releases/assets/77070369",
        "id": 77070369,
        "node_id": "RA_kwDOH7dDGs4EmAAh",
        "name": "com.vrchat.demo-template-0.0.3.unitypackage",
        "label": "",
        "uploader": {
          "login": "github-actions[bot]",
          "id": 41898282,
          "node_id": "MDM6Qm90NDE4OTgyODI=",
          "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/github-actions%5Bbot%5D",
          "html_url": "https://github.com/apps/github-actions",
          "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
          "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
          "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
          "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
          "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
          "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
          "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
          "type": "Bot",
          "site_admin": false
        },
        "content_type": "application/octet-stream",
        "state": "uploaded",
        "size": 1251,
        "download_count": 65,
        "created_at": "2022-09-06T22:47:12Z",
        "updated_at": "2022-09-06T22:47:12Z",
        "browser_download_url": "https://github.com/vrchat-community/template-package/releases/download/0.0.3/com.vrchat.demo-template-0.0.3.unitypackage"
      },
      {
        "url": "https://api.github.com/repos/vrchat-community/template-package/releases/assets/77070370",
        "id": 77070370,
        "node_id": "RA_kwDOH7dDGs4EmAAi",
        "name": "com.vrchat.demo-template-0.0.3.zip",
        "label": "",
        "uploader": {
          "login": "github-actions[bot]",
          "id": 41898282,
          "node_id": "MDM6Qm90NDE4OTgyODI=",
          "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/github-actions%5Bbot%5D",
          "html_url": "https://github.com/apps/github-actions",
          "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
          "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
          "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
          "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
          "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
          "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
          "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
          "type": "Bot",
          "site_admin": false
        },
        "content_type": "application/zip",
        "state": "uploaded",
        "size": 2580,
        "download_count": 41,
        "created_at": "2022-09-06T22:47:12Z",
        "updated_at": "2022-09-06T22:47:12Z",
        "browser_download_url": "https://github.com/vrchat-community/template-package/releases/download/0.0.3/com.vrchat.demo-template-0.0.3.zip"
      },
      {
        "url": "https://api.github.com/repos/vrchat-community/template-package/releases/assets/77070371",
        "id": 77070371,
        "node_id": "RA_kwDOH7dDGs4EmAAj",
        "name": "package.json",
        "label": "",
        "uploader": {
          "login": "github-actions[bot]",
          "id": 41898282,
          "node_id": "MDM6Qm90NDE4OTgyODI=",
          "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/github-actions%5Bbot%5D",
          "html_url": "https://github.com/apps/github-actions",
          "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
          "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
          "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
          "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
          "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
          "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
          "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
          "type": "Bot",
          "site_admin": false
        },
        "content_type": "application/json",
        "state": "uploaded",
        "size": 339,
        "download_count": 27,
        "created_at": "2022-09-06T22:47:12Z",
        "updated_at": "2022-09-06T22:47:12Z",
        "browser_download_url": "https://github.com/vrchat-community/template-package/releases/download/0.0.3/package.json"
      }
    ],
    "tarball_url": "https://api.github.com/repos/vrchat-community/template-package/tarball/0.0.3",
    "zipball_url": "https://api.github.com/repos/vrchat-community/template-package/zipball/0.0.3",
    "body": ""
  },
  {
    "url": "https://api.github.com/repos/vrchat-community/template-package/releases/76188566",
    "assets_url": "https://api.github.com/repos/vrchat-community/template-package/releases/76188566/assets",
    "upload_url": "https://uploads.github.com/repos/vrchat-community/template-package/releases/76188566/assets{?name,label}",
    "html_url": "https://github.com/vrchat-community/template-package/releases/tag/0.0.2",
    "id": 76188566,
    "author": {
      "login": "github-actions[bot]",
      "id": 41898282,
      "node_id": "MDM6Qm90NDE4OTgyODI=",
      "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/github-actions%5Bbot%5D",
      "html_url": "https://github.com/apps/github-actions",
      "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
      "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
      "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
      "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
      "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
      "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
      "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
      "type": "Bot",
      "site_admin": false
    },
    "node_id": "RE_kwDOH7dDGs4EiouW",
    "tag_name": "0.0.2",
    "target_commitish": "main",
    "name": "0.0.2",
    "draft": false,
    "prerelease": false,
    "created_at": "2022-09-02T23:27:47Z",
    "published_at": "2022-09-02T23:28:20Z",
    "assets": [
      {
        "url": "https://api.github.com/repos/vrchat-community/template-package/releases/assets/76720978",
        "id": 76720978,
        "node_id": "RA_kwDOH7dDGs4EkqtS",
        "name": "com.vrchat.demo-template-0.0.2.unitypackage",
        "label": "",
        "uploader": {
          "login": "github-actions[bot]",
          "id": 41898282,
          "node_id": "MDM6Qm90NDE4OTgyODI=",
          "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/github-actions%5Bbot%5D",
          "html_url": "https://github.com/apps/github-actions",
          "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
          "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
          "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
          "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
          "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
          "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
          "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
          "type": "Bot",
          "site_admin": false
        },
        "content_type": "application/octet-stream",
        "state": "uploaded",
        "size": 1254,
        "download_count": 7,
        "created_at": "2022-09-03T00:01:57Z",
        "updated_at": "2022-09-03T00:01:58Z",
        "browser_download_url": "https://github.com/vrchat-community/template-package/releases/download/0.0.2/com.vrchat.demo-template-0.0.2.unitypackage"
      },
      {
        "url": "https://api.github.com/repos/vrchat-community/template-package/releases/assets/76720979",
        "id": 76720979,
        "node_id": "RA_kwDOH7dDGs4EkqtT",
        "name": "com.vrchat.demo-template-0.0.2.zip",
        "label": "",
        "uploader": {
          "login": "github-actions[bot]",
          "id": 41898282,
          "node_id": "MDM6Qm90NDE4OTgyODI=",
          "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/github-actions%5Bbot%5D",
          "html_url": "https://github.com/apps/github-actions",
          "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
          "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
          "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
          "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
          "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
          "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
          "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
          "type": "Bot",
          "site_admin": false
        },
        "content_type": "application/zip",
        "state": "uploaded",
        "size": 2579,
        "download_count": 14,
        "created_at": "2022-09-03T00:01:57Z",
        "updated_at": "2022-09-03T00:01:58Z",
        "browser_download_url": "https://github.com/vrchat-community/template-package/releases/download/0.0.2/com.vrchat.demo-template-0.0.2.zip"
      },
      {
        "url": "https://api.github.com/repos/vrchat-community/template-package/releases/assets/76720980",
        "id": 76720980,
        "node_id": "RA_kwDOH7dDGs4EkqtU",
        "name": "package.json",
        "label": "",
        "uploader": {
          "login": "github-actions[bot]",
          "id": 41898282,
          "node_id": "MDM6Qm90NDE4OTgyODI=",
          "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/github-actions%5Bbot%5D",
          "html_url": "https://github.com/apps/github-actions",
          "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
          "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
          "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
          "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
          "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
          "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
          "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
          "type": "Bot",
          "site_admin": false
        },
        "content_type": "application/json",
        "state": "uploaded",
        "size": 338,
        "download_count": 12,
        "created_at": "2022-09-03T00:01:57Z",
        "updated_at": "2022-09-03T00:01:58Z",
        "browser_download_url": "https://github.com/vrchat-community/template-package/releases/download/0.0.2/package.json"
      }
    ],
    "tarball_url": "https://api.github.com/repos/vrchat-community/template-package/tarball/0.0.2",
    "zipball_url": "https://api.github.com/repos/vrchat-community/template-package/zipball/0.0.2",
    "body": ""
  }
]

it seems like uploader uses CommitAuthor, which may have both the name, or the email fields set as null, which isn't the case in https://github.com/XAMPPRocky/octocrab/blob/3f702b58ca4d1c2372f177c9d6987adebb9c2c32/src/models/repos.rs#L142-L147

L1ghtman2k commented 1 year ago

There might be a need to introduce a separate Uploader struct, instead of relying on CommitAuthor?

koyashiro commented 1 year ago

This issue continues to reproduce in v0.21.0.

XAMPPRocky commented 1 year ago

@koyashiro Well of course, because no one has submitted a fix šŸ˜„

@L1ghtman2k Is there a reason we can't use the CommitAuthor for this?

L1ghtman2k commented 1 year ago

@XAMPPRocky from my comment above that has a bit more context:

it seems likeĀ uploaderĀ usesĀ CommitAuthor, which may have both theĀ name, or theĀ emailĀ fields set as null, which isn't the case inĀ https://github.com/XAMPPRocky/octocrab/blob/3f702b58ca4d1c2372f177c9d6987adebb9c2c32/src/models/repos.rs#L142-L147.

Basically CommitAuthor has name and and email fields required where as in this request they are not present

XAMPPRocky commented 1 year ago

@L1ghtman2k So the solution is to update CommitAuthor to match, or do you think it's worth having a separate type for uploader?

L1ghtman2k commented 1 year ago

@L1ghtman2k So the solution is to update CommitAuthor to match, or do you think it's worth having a separate type for the uploader?

@XAMPPRocky, I got around to looking a bit more at this. It seems like we need a separate Uploader type here, judging by the schemas in: https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-commits--parameters and https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#list-releases--parameters

However, I am unfamiliar with generating rust structs from json schemas. For instance, both of the above types can have CommitAuthor, or the Uploader as null, but it seems like the current implementation of Commit sets author: CommitAuthor, instead of author: Option<CommitAuthor>: https://github.com/XAMPPRocky/octocrab/blob/503cca11d6f4faa47fef4b9c378aafdc64a0be9c/src/models/events/payload.rs#L63 I am not sure if it is a bug, or if there is some implicit handling of null types.

If it is the bug, then I think my understanding is a bit more solid, and I can use something along the lines of https://github.com/oxidecomputer/typify, or manually migrate the Uploader type into Octocrab

erratic-pattern commented 1 year ago

Created PR #355 to create an Uploader struct and make the uploader field an Option<Uploader>.