Closed PromoFaux closed 1 year ago
And because the issue body was too long....
@PromoFaux, thanks for catching and tracking this. It looks like there's potentially a model//schema change given you're getting a serialization error - i.e., what is coming back does not match what octokit expects for deserialization.
I'll get this prioritized and in our backlog; in the meantime, Is this something you'd be interested in following through on and cutting a PR with a fix?
Sure, if I get a chance to dig deep, then happy to take a look (don't let that dissuade anyone else from doing it if they can do it quicker than me!)
Looks like body
was updated recently to be string | object
So I think this is where I start to get a bit out of my depth - certainly in terms of how the project is structured, and knowing where to start!
While I was looking at PackageVersion.cs
to start looking into this, I noticed also that docker_metadata
has been changed to container_metadata
, and the contents of that property also do not fit the currently published schema
What is the usual course of action here? Wait until the schema is updated to follow it's guidance, or make a best-guess based on the above payloads? (Or just both to dynamic
and sweep it under the carpet for a bit....? 😬)
Unfortunately, C# doesn't have support for union types, though it is being discussed for a future language version. So what is easy in TypeScript (string | { ... }
) is a lot harder in C#.
I think there are a couple of possibilities here:
object
, dynamic
, or JsonElement
What do you think?
I decided to go with dynamic
as I use it elsewhere in the package.
What happened?
Spotted some errors processing package events this morning
I have not dug into this yet as I am at work - but posting here for tracking. I'm not currently consuming these payloads - we're just set up to send everything
Example payload from `package.published`
```json { "action": "published", "package": { "id": 1118375, "name": "pihole", "namespace": "pi-hole", "description": "", "ecosystem": "CONTAINER", "package_type": "CONTAINER", "html_url": "https://github.com/pi-hole/packages/1118375", "created_at": "2021-11-18T01:15:49Z", "updated_at": "2021-11-18T01:15:49Z", "owner": { "login": "pi-hole", "id": 16827203, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE2ODI3MjAz", "avatar_url": "https://avatars.githubusercontent.com/u/16827203?v=4", "gravatar_id": "", "url": "https://api.github.com/users/pi-hole", "html_url": "https://github.com/pi-hole", "followers_url": "https://api.github.com/users/pi-hole/followers", "following_url": "https://api.github.com/users/pi-hole/following{/other_user}", "gists_url": "https://api.github.com/users/pi-hole/gists{/gist_id}", "starred_url": "https://api.github.com/users/pi-hole/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pi-hole/subscriptions", "organizations_url": "https://api.github.com/users/pi-hole/orgs", "repos_url": "https://api.github.com/users/pi-hole/repos", "events_url": "https://api.github.com/users/pi-hole/events{/privacy}", "received_events_url": "https://api.github.com/users/pi-hole/received_events", "type": "Organization", "site_admin": false }, "package_version": { "id": 57755790, "version": "sha256:16bdd656f9e81ba610c21bcf3878384965cfdab2465cbc1fc350f6cfe1e0e8ef", "name": "sha256:16bdd656f9e81ba610c21bcf3878384965cfdab2465cbc1fc350f6cfe1e0e8ef", "description": "Pi-hole in a docker container", "summary": "Pi-hole in a docker container", "body": { "repository": { "repository": { "id": 50894333, "name": "docker-pi-hole", "owner_id": 16827203, "parent_id": null, "sandbox": null, "updated_at": "2022-12-08T01:18:24.000Z", "created_at": "2016-02-02T04:33:35.000Z", "public": true, "description": "Pi-hole in a docker container", "homepage": "https://pi-hole.net", "source_id": 122035788, "public_push": null, "disk_usage": 1503, "locked": false, "pushed_at": "2022-11-30T22:40:28.000Z", "watcher_count": 5955, "public_fork_count": 1001, "primary_language_name_id": 139, "has_issues": true, "has_wiki": true, "has_downloads": true, "raw_data": { "data": { "created_by_user_id": 868002, "primary_language_name": "Shell", "completed_onboarding_tasks": [ ] } }, "organization_id": 16827203, "disabled_at": null, "disabled_by": null, "disabling_reason": null, "health_status": "ok", "pushed_at_usec": 57989, "active": true, "reflog_sync_enabled": false, "made_public_at": null, "user_hidden": 0, "maintained": true, "template": false, "owner_login": "pi-hole", "world_writable_wiki": false, "refset_updated_at": "2022-11-30T22:38:31.361Z", "disabling_detail": null, "archived_at": null } }, "info": { "type": "blob", "oid": "326b0e08c815245a11be4b399c51e419f334f569", "mode": 33188, "name": "README.md", "path": "README.md", "size": null, "collection": true }, "attributes": { }, "_formatted": true }, "manifest": "", "html_url": "https://github.com/orgs/pi-hole/packages/container/pihole/57755790", "target_commitish": "master", "target_oid": "a787e29aad4604a42eee6f553fd6df6f08461b1e", "created_at": "0001-01-01T00:00:00Z", "updated_at": "0001-01-01T00:00:00Z", "metadata": [ ], "container_metadata": { "tag": { "name": "", "digest": "sha256:16bdd656f9e81ba610c21bcf3878384965cfdab2465cbc1fc350f6cfe1e0e8ef" }, "labels": { "description": "Pi-hole in a docker container", "source": "https://github.com/pi-hole/docker-pi-hole", "revision": "", "image_url": "https://github.com/pi-hole/docker-pi-hole", "licenses": "", "all_labels": { "org.opencontainers.image.url": "https://github.com/pi-hole/docker-pi-hole", "org.opencontainers.image.licenses": "", "org.opencontainers.image.title": "docker-pi-hole", "org.opencontainers.image.revision": "a787e29aad4604a42eee6f553fd6df6f08461b1e", "org.opencontainers.image.created": "2022-12-08T02:26:18.143Z", "org.opencontainers.image.version": "nightly", "org.opencontainers.image.description": "Pi-hole in a docker container", "org.opencontainers.image.source": "https://github.com/pi-hole/docker-pi-hole" } }, "manifest": { "digest": "sha256:16bdd656f9e81ba610c21bcf3878384965cfdab2465cbc1fc350f6cfe1e0e8ef", "media_type": "application/vnd.docker.distribution.manifest.v2+json", "uri": "repositories/pi-hole/pihole/manifests/sha256:16bdd656f9e81ba610c21bcf3878384965cfdab2465cbc1fc350f6cfe1e0e8ef", "size": 1782, "config": { "digest": "sha256:37e1478a8ffb0513113dbbb172bfafdf56ba24014a671921a2593d83da7a0608", "media_type": "application/vnd.docker.container.image.v1+json", "size": 7205 }, "layers": [ { "digest": "sha256:fd18d0201d0ce0c5e103902d894f5d601fc5dde76688aa7dae786840141d23e4", "media_type": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 26576195 }, { "digest": "sha256:0fa20a868a60ceb7bc8a95981a4bd56fac4c2d9de1f8745eae546146e48a8e0f", "media_type": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 51166445 }, { "digest": "sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1", "media_type": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 32 }, { "digest": "sha256:2ad7497455cdab76764a94c36fa2fc898c146b4d996bbd01beda28ca303e8a62", "media_type": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 130 }, { "digest": "sha256:f09600ea01bd4ba5ef2a7d3690c7d46147b924e680cc9034194263b86f3d6bd7", "media_type": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 12202 }, { "digest": "sha256:783c2f94749191f27129ee0bb80ff4db26f49af8a82aa67c85fc9444ce189d0c", "media_type": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 727 }, { "digest": "sha256:3d98f361b22ebdff75986009b3077e5590d90ea81c9df95d0cf9e311436add74", "media_type": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 41670773 } ] } }, "package_files": [ ], "installation_command": "docker pull ghcr.io/pi-hole/pihole:", "package_url": "ghcr.io/pi-hole/pihole:" }, "registry": { "about_url": "https://docs.github.com/packages/learn-github-packages/introduction-to-github-packages", "name": "GitHub CONTAINER registry", "type": "CONTAINER", "url": "https://CONTAINER.pkg.github.com/pi-hole", "vendor": "GitHub Inc" } }, "repository": { "id": 50894333, "node_id": "MDEwOlJlcG9zaXRvcnk1MDg5NDMzMw==", "name": "docker-pi-hole", "full_name": "pi-hole/docker-pi-hole", "private": false, "owner": { "login": "pi-hole", "id": 16827203, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE2ODI3MjAz", "avatar_url": "https://avatars.githubusercontent.com/u/16827203?v=4", "gravatar_id": "", "url": "https://api.github.com/users/pi-hole", "html_url": "https://github.com/pi-hole", "followers_url": "https://api.github.com/users/pi-hole/followers", "following_url": "https://api.github.com/users/pi-hole/following{/other_user}", "gists_url": "https://api.github.com/users/pi-hole/gists{/gist_id}", "starred_url": "https://api.github.com/users/pi-hole/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/pi-hole/subscriptions", "organizations_url": "https://api.github.com/users/pi-hole/orgs", "repos_url": "https://api.github.com/users/pi-hole/repos", "events_url": "https://api.github.com/users/pi-hole/events{/privacy}", "received_events_url": "https://api.github.com/users/pi-hole/received_events", "type": "Organization", "site_admin": false }, "html_url": "https://github.com/pi-hole/docker-pi-hole", "description": "Pi-hole in a docker container", "fork": false, "url": "https://api.github.com/repos/pi-hole/docker-pi-hole", "forks_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/forks", "keys_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/keys{/key_id}", "collaborators_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/collaborators{/collaborator}", "teams_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/teams", "hooks_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/hooks", "issue_events_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/issues/events{/number}", "events_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/events", "assignees_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/assignees{/user}", "branches_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/branches{/branch}", "tags_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/tags", "blobs_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/git/blobs{/sha}", "git_tags_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/git/tags{/sha}", "git_refs_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/git/refs{/sha}", "trees_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/git/trees{/sha}", "statuses_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/statuses/{sha}", "languages_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/languages", "stargazers_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/stargazers", "contributors_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/contributors", "subscribers_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/subscribers", "subscription_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/subscription", "commits_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/commits{/sha}", "git_commits_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/git/commits{/sha}", "comments_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/comments{/number}", "issue_comment_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/issues/comments{/number}", "contents_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/contents/{+path}", "compare_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/compare/{base}...{head}", "merges_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/merges", "archive_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/{archive_format}{/ref}", "downloads_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/downloads", "issues_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/issues{/number}", "pulls_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/pulls{/number}", "milestones_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/milestones{/number}", "notifications_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/notifications{?since,all,participating}", "labels_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/labels{/name}", "releases_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/releases{/id}", "deployments_url": "https://api.github.com/repos/pi-hole/docker-pi-hole/deployments", "created_at": "2016-02-02T04:33:35Z", "updated_at": "2022-12-08T01:18:24Z", "pushed_at": "2022-11-30T22:40:28Z", "git_url": "git://github.com/pi-hole/docker-pi-hole.git", "ssh_url": "git@github.com:pi-hole/docker-pi-hole.git", "clone_url": "https://github.com/pi-hole/docker-pi-hole.git", "svn_url": "https://github.com/pi-hole/docker-pi-hole", "homepage": "https://pi-hole.net", "size": 1503, "stargazers_count": 5955, "watchers_count": 5955, "language": "Shell", "has_issues": true, "has_projects": true, "has_downloads": true, "has_wiki": true, "has_pages": false, "has_discussions": true, "forks_count": 1001, "mirror_url": null, "archived": false, "disabled": false, "open_issues_count": 32, "license": null, "allow_forking": true, "is_template": false, "web_commit_signoff_required": true, "topics": [ "ad-blocker", "dns", "docker-container", "hacktoberfest", "pi-hole", "web-app" ], "visibility": "public", "forks": 1001, "open_issues": 32, "watchers": 5955, "default_branch": "master" }, "organization": { "login": "pi-hole", "id": 16827203, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE2ODI3MjAz", "url": "https://api.github.com/orgs/pi-hole", "repos_url": "https://api.github.com/orgs/pi-hole/repos", "events_url": "https://api.github.com/orgs/pi-hole/events", "hooks_url": "https://api.github.com/orgs/pi-hole/hooks", "issues_url": "https://api.github.com/orgs/pi-hole/issues", "members_url": "https://api.github.com/orgs/pi-hole/members{/member}", "public_members_url": "https://api.github.com/orgs/pi-hole/public_members{/member}", "avatar_url": "https://avatars.githubusercontent.com/u/16827203?v=4", "description": "A black hole for Internet advertisements" }, "sender": { "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 } } ```Versions
Octokit.Webhooks.AspNetCore v1.3.5
Relevant log output
Code of Conduct