softprops / afterparty

rust github webhook server
MIT License
55 stars 13 forks source link

parse errors on various events #12

Open clux opened 8 years ago

clux commented 8 years ago

Hey, I am trying to use this library for an experimental project. I really like how you are generating api bindings from example data :smile:

However, using it I am getting tons of parse errors from various events when trying to run this at the moment. Here's output from the ping event:

afterparty: recv 'ping' event with signature 'Some(XHubSignature("sha1=e5cadd4c82bb46be2b19f3be79a7d0de4d8efa1b"))'
afterparty: failed to parse json SyntaxError(unknown field "type", 1, 81)
"{\"Ping\":{\"zen\":\"Responsive is better than fast.\",\"hook_id\":8872023,\"hook\":{\"type\":\"Repository\",\"id\":8872023,\"name\":\"web\",\"active\":true,\"events\":[\"issues\",\"issue_comment\",\"pull_request\",\"pull_request_review_comment\",\"push\",\"status\"],\"config\":{\"content_type\":\"json\",\"insecure_ssl\":\"0\",\"secret\":\"********\",\"url\":\"http://109.146.234.160:54857\"},\"updated_at\":\"2016-06-23T19:25:48Z\",\"created_at\":\"2016-06-23T19:25:48Z\",\"url\":\"https://api.github.com/repos/clux/volf/hooks/8872023\",\"test_url\":\"https://api.github.com/repos/clux/volf/hooks/8872023/test\",\"ping_url\":\"https://api.github.com/repos/clux/volf/hooks/8872023/pings\",\"last_response\":{\"code\":null,\"status\":\"unused\",\"message\":null}},\"repository\":{\"id\":61758654,\"name\":\"volf\",\"full_name\":\"clux/volf\",\"owner\":{\"login\":\"clux\",\"id\":134092,\"avatar_url\":\"https://avatars.githubusercontent.com/u/134092?v=3\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/clux\",\"html_url\":\"https://github.com/clux\",\"followers_url\":\"https://api.github.com/users/clux/followers\",\"following_url\":\"https://api.github.com/users/clux/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/clux/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/clux/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/clux/subscriptions\",\"organizations_url\":\"https://api.github.com/users/clux/orgs\",\"repos_url\":\"https://api.github.com/users/clux/repos\",\"events_url\":\"https://api.github.com/users/clux/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/clux/received_events\",\"type\":\"User\",\"site_admin\":false},\"private\":false,\"html_url\":\"https://github.com/clux/volf\",\"description\":\"A simple Github webhook bot (SKELETAL CODE ONLY SO FAR)\",\"fork\":false,\"url\":\"https://api.github.com/repos/clux/volf\",\"forks_url\":\"https://api.github.com/repos/clux/volf/forks\",\"keys_url\":\"https://api.github.com/repos/clux/volf/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/clux/volf/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/clux/volf/teams\",\"hooks_url\":\"https://api.github.com/repos/clux/volf/hooks\",\"issue_events_url\":\"https://api.github.com/repos/clux/volf/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/clux/volf/events\",\"assignees_url\":\"https://api.github.com/repos/clux/volf/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/clux/volf/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/clux/volf/tags\",\"blobs_url\":\"https://api.github.com/repos/clux/volf/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/clux/volf/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/clux/volf/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/clux/volf/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/clux/volf/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/clux/volf/languages\",\"stargazers_url\":\"https://api.github.com/repos/clux/volf/stargazers\",\"contributors_url\":\"https://api.github.com/repos/clux/volf/contributors\",\"subscribers_url\":\"https://api.github.com/repos/clux/volf/subscribers\",\"subscription_url\":\"https://api.github.com/repos/clux/volf/subscription\",\"commits_url\":\"https://api.github.com/repos/clux/volf/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/clux/volf/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/clux/volf/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/clux/volf/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/clux/volf/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/clux/volf/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/clux/volf/merges\",\"archive_url\":\"https://api.github.com/repos/clux/volf/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/clux/volf/downloads\",\"issues_url\":\"https://api.github.com/repos/clux/volf/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/clux/volf/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/clux/volf/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/clux/volf/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/clux/volf/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/clux/volf/releases{/id}\",\"deployments_url\":\"https://api.github.com/repos/clux/volf/deployments\",\"created_at\":\"2016-06-22T23:37:16Z\",\"updated_at\":\"2016-06-22T23:40:11Z\",\"pushed_at\":\"2016-06-22T23:39:47Z\",\"git_url\":\"git://github.com/clux/volf.git\",\"ssh_url\":\"git@github.com:clux/volf.git\",\"clone_url\":\"https://github.com/clux/volf.git\",\"svn_url\":\"https://github.com/clux/volf\",\"homepage\":\"\",\"size\":6,\"stargazers_count\":0,\"watchers_count\":0,\"language\":\"Rust\",\"has_issues\":true,\"has_downloads\":true,\"has_wiki\":true,\"has_pages\":false,\"forks_count\":0,\"mirror_url\":null,\"open_issues_count\":0,\"forks\":0,\"open_issues\":0,\"watchers\":0,\"default_branch\":\"master\"},\"sender\":{\"login\":\"clux\",\"id\":134092,\"avatar_url\":\"https://avatars.githubusercontent.com/u/134092?v=3\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/clux\",\"html_url\":\"https://github.com/clux\",\"followers_url\":\"https://api.github.com/users/clux/followers\",\"following_url\":\"https://api.github.com/users/clux/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/clux/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/clux/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/clux/subscriptions\",\"organizations_url\":\"https://api.github.com/users/clux/orgs\",\"repos_url\":\"https://api.github.com/users/clux/repos\",\"events_url\":\"https://api.github.com/users/clux/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/clux/received_events\",\"type\":\"User\",\"site_admin\":false}}}"
afterparty: failed to parse event "ping" for delivery "49e54600-3978-11e6-8326-aa9bc862137f"

I cross-referenced the data sent with the data/schema you are using to build the Event type and it appears to miss out a couple of things.

Presumably this should just be a case of updating the data directory and rebuilding afterparty?

clux commented 8 years ago

Have cloned afterparty and tried out with some updated schemas, parse errors appear to go away. I can submit a PR with some updates as I go along if you'd like.

That is, unless you have an efficient way to synch updated schemas.

Edit: Had a go. Updated a few schemas, got rid of some errors, but am now stuck on new parse errors on a mystical name property of both status and push events - and the schemas should be correct now. Giving up for today.

softprops commented 8 years ago

Hi @clux if you open a pr I'll happily merge and publish a new version. Thanks for reporting the issue

clux commented 8 years ago

See #13

softprops commented 7 years ago

Hi @clux I wanted to let you know I published a new version 0.1.1 with some updates to hyper and serde versions which should be a bit more forgiving with parse errors. I'll leave this issue open in case other issues pop up