Some Github repo commits don't have a valid author.
Example: curl https://api.github.com/repos/TNG/ArchUnit/commits/c395bc282b6c52feb0165a1657086d711547829f.
In this case, the API returns null for the author field.
This cannot be deserialized properly into a User struct by serde.
As a result, we're getting errors when using hubcaps to read a list of commits over here:
hubcaps should not throw an error or this edge-case should be documented with a workaround.
I was also thinking that the author field might be optional and be None in case of null, but that would be a breaking change and it would make the normal flow a bit more cumbersome.
👟 Steps to reproduce
use hubcaps::{Credentials, Github, Result};
use std::env;
#[tokio::main]
async fn main() -> Result<()> {
let github = Github::new(
String::from("user-agent-name"),
env::var("GITHUB_TOKEN").ok().map(Credentials::Token),
)?;
github
.repo("tng", "archunit")
.commits()
.get("c395bc282b6c52feb0165a1657086d711547829f")
.await?;
Ok(())
}
🐛 Bug description
Some Github repo commits don't have a valid author. Example:
curl https://api.github.com/repos/TNG/ArchUnit/commits/c395bc282b6c52feb0165a1657086d711547829f
.In this case, the API returns
null
for the author field. This cannot be deserialized properly into aUser
struct by serde. As a result, we're getting errors when using hubcaps to read a list of commits over here:(See the example code below to reproduce.)
🤔 Expected Behavior
hubcaps should not throw an error or this edge-case should be documented with a workaround. I was also thinking that the author field might be optional and be
None
in case ofnull
, but that would be a breaking change and it would make the normal flow a bit more cumbersome.👟 Steps to reproduce
🌍 Your environment
hubcaps version: 0.6.1 tokio: 0.2
Credits
@AristoChen for finding the bug.