Closed koyashiro closed 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
There might be a need to introduce a separate Uploader
struct, instead of relying on CommitAuthor?
This issue continues to reproduce in v0.21.0.
@koyashiro Well of course, because no one has submitted a fix š
@L1ghtman2k Is there a reason we can't use the CommitAuthor for this?
@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
@L1ghtman2k So the solution is to update CommitAuthor
to match, or do you think it's worth having a separate type for uploader?
@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
Created PR #355 to create an Uploader
struct and make the uploader field an Option<Uploader>
.
The following error occurs when executing the following code in v0.20.0.
This error is not reproduced in v0.19.0.
Cargo.toml
:src/main.rs
: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