{"action":"created","comment":{"url":"https://api.github.com/repos/NuGet/ServerCommon/pulls/comments/144132411","pull_request_review_id":68747699,"id":144132411,"diff_hunk":"@@ -0,0 +1,91 @@\n+﻿using System;\n+using Newtonsoft.Json;\n+\n+namespace NuGet.Services.ServiceBus\n+{\n+    /// <summary>\n+    /// Serializes objects into Service Bus <see cref=\"IBrokeredMessage\"/>. This serializer will\n+    /// throw <see cref=\"FormatException\"/> if the message does not contain a message with the expected\n+    /// type and schema version.\n+    /// </summary>\n+    /// <typeparam name=\"TMessage\">A type decorated with a <see cref=\"SchemaVersionAttribute\"/>.</typeparam>\n+    public class BrokedMessageSerializer<TMessage>\n+    {\n+        private const string SchemaVersionKey = \"SchemaVersion\";\n+        private const string TypeKey = \"Type\";\n+\n+        private static readonly string MessageType;\n+        private static readonly int SchemaVersion;\n+\n+        static BrokedMessageSerializer()\n+        {\n+            var schemaAttribute = typeof(SchemaVersionAttribute);\n+            var attributes = typeof(TMessage).GetCustomAttributes(schemaAttribute, inherit: false);\n+\n+            if (attributes == null || attributes.Length != 1)\n+            {\n+                throw new InvalidOperationException($\"{typeof(TMessage)} must have exactly one {nameof(SchemaVersionAttribute)}\");\n+            }\n+\n+            MessageType = typeof(TMessage).Name;","path":"src/NuGet.Services.ServiceBus/BrokedMessageSerializer.cs","position":null,"original_position":30,"commit_id":"761e5691281919de30365754caa5d6e84f183349","original_commit_id":"740672b612c406b3da87c11f01a11d6412d77ddd","user":{"login":"loic-sharma","id":737941,"avatar_url":"https://avatars3.githubusercontent.com/u/737941?v=4","gravatar_id":"","url":"https://api.github.com/users/loic-sharma","html_url":"https://github.com/loic-sharma","followers_url":"https://api.github.com/users/loic-sharma/followers","following_url":"https://api.github.com/users/loic-sharma/following{/other_user}","gists_url":"https://api.github.com/users/loic-sharma/gists{/gist_id}","starred_url":"https://api.github.com/users/loic-sharma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loic-sharma/subscriptions","organizations_url":"https://api.github.com/users/loic-sharma/orgs","repos_url":"https://api.github.com/users/loic-sharma/repos","events_url":"https://api.github.com/users/loic-sharma/events{/privacy}","received_events_url":"https://api.github.com/users/loic-sharma/received_events","type":"User","site_admin":false},"body":"Good point. I'll add an attribute to the name.","created_at":"2017-10-11T20:51:40Z","updated_at":"2017-10-11T20:51:40Z","html_url":"https://github.com/NuGet/ServerCommon/pull/70#discussion_r144132411","pull_request_url":"https://api.github.com/repos/NuGet/ServerCommon/pulls/70","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/NuGet/ServerCommon/pulls/comments/144132411"},"html":{"href":"https://github.com/NuGet/ServerCommon/pull/70#discussion_r144132411"},"pull_request":{"href":"https://api.github.com/repos/NuGet/ServerCommon/pulls/70"}},"in_reply_to_id":144126502},"pull_request":{"url":"https://api.github.com/repos/NuGet/ServerCommon/pulls/70","id":146050350,"html_url":"https://github.com/NuGet/ServerCommon/pull/70","diff_url":"https://github.com/NuGet/ServerCommon/pull/70.diff","patch_url":"https://github.com/NuGet/ServerCommon/pull/70.patch","issue_url":"https://api.github.com/repos/NuGet/ServerCommon/issues/70","number":70,"state":"open","locked":false,"title":"Added generic Service Bus serializer","user":{"login":"loic-sharma","id":737941,"avatar_url":"https://avatars3.githubusercontent.com/u/737941?v=4","gravatar_id":"","url":"https://api.github.com/users/loic-sharma","html_url":"https://github.com/loic-sharma","followers_url":"https://api.github.com/users/loic-sharma/followers","following_url":"https://api.github.com/users/loic-sharma/following{/other_user}","gists_url":"https://api.github.com/users/loic-sharma/gists{/gist_id}","starred_url":"https://api.github.com/users/loic-sharma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loic-sharma/subscriptions","organizations_url":"https://api.github.com/users/loic-sharma/orgs","repos_url":"https://api.github.com/users/loic-sharma/repos","events_url":"https://api.github.com/users/loic-sharma/events{/privacy}","received_events_url":"https://api.github.com/users/loic-sharma/received_events","type":"User","site_admin":false},"body":"Added `BrokedMessageSerializer`, a JSON serializer that enforces versioned schemas. Updated the `PackageValidationMessageData` serializer to use this new serializer. This will be used by `PackageSigningValidator` and `PackageCertificatesValidator` to queue messages to their downstream validation jobs.","created_at":"2017-10-11T20:13:48Z","updated_at":"2017-10-11T20:52:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba7ff0283f410c3874ab15e0fc8d4e9702850a5c","assignee":{"login":"loic-sharma","id":737941,"avatar_url":"https://avatars3.githubusercontent.com/u/737941?v=4","gravatar_id":"","url":"https://api.github.com/users/loic-sharma","html_url":"https://github.com/loic-sharma","followers_url":"https://api.github.com/users/loic-sharma/followers","following_url":"https://api.github.com/users/loic-sharma/following{/other_user}","gists_url":"https://api.github.com/users/loic-sharma/gists{/gist_id}","starred_url":"https://api.github.com/users/loic-sharma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loic-sharma/subscriptions","organizations_url":"https://api.github.com/users/loic-sharma/orgs","repos_url":"https://api.github.com/users/loic-sharma/repos","events_url":"https://api.github.com/users/loic-sharma/events{/privacy}","received_events_url":"https://api.github.com/users/loic-sharma/received_events","type":"User","site_admin":false},"assignees":[{"login":"loic-sharma","id":737941,"avatar_url":"https://avatars3.githubusercontent.com/u/737941?v=4","gravatar_id":"","url":"https://api.github.com/users/loic-sharma","html_url":"https://github.com/loic-sharma","followers_url":"https://api.github.com/users/loic-sharma/followers","following_url":"https://api.github.com/users/loic-sharma/following{/other_user}","gists_url":"https://api.github.com/users/loic-sharma/gists{/gist_id}","starred_url":"https://api.github.com/users/loic-sharma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loic-sharma/subscriptions","organizations_url":"https://api.github.com/users/loic-sharma/orgs","repos_url":"https://api.github.com/users/loic-sharma/repos","events_url":"https://api.github.com/users/loic-sharma/events{/privacy}","received_events_url":"https://api.github.com/users/loic-sharma/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"agr","id":102933,"avatar_url":"https://avatars1.githubusercontent.com/u/102933?v=4","gravatar_id":"","url":"https://api.github.com/users/agr","html_url":"https://github.com/agr","followers_url":"https://api.github.com/users/agr/followers","following_url":"https://api.github.com/users/agr/following{/other_user}","gists_url":"https://api.github.com/users/agr/gists{/gist_id}","starred_url":"https://api.github.com/users/agr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agr/subscriptions","organizations_url":"https://api.github.com/users/agr/orgs","repos_url":"https://api.github.com/users/agr/repos","events_url":"https://api.github.com/users/agr/events{/privacy}","received_events_url":"https://api.github.com/users/agr/received_events","type":"User","site_admin":false},{"login":"xavierdecoster","id":880728,"avatar_url":"https://avatars3.githubusercontent.com/u/880728?v=4","gravatar_id":"","url":"https://api.github.com/users/xavierdecoster","html_url":"https://github.com/xavierdecoster","followers_url":"https://api.github.com/users/xavierdecoster/followers","following_url":"https://api.github.com/users/xavierdecoster/following{/other_user}","gists_url":"https://api.github.com/users/xavierdecoster/gists{/gist_id}","starred_url":"https://api.github.com/users/xavierdecoster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xavierdecoster/subscriptions","organizations_url":"https://api.github.com/users/xavierdecoster/orgs","repos_url":"https://api.github.com/users/xavierdecoster/repos","events_url":"https://api.github.com/users/xavierdecoster/events{/privacy}","received_events_url":"https://api.github.com/users/xavierdecoster/received_events","type":"User","site_admin":false},{"login":"skofman1","id":16807822,"avatar_url":"https://avatars1.githubusercontent.com/u/16807822?v=4","gravatar_id":"","url":"https://api.github.com/users/skofman1","html_url":"https://github.com/skofman1","followers_url":"https://api.github.com/users/skofman1/followers","following_url":"https://api.github.com/users/skofman1/following{/other_user}","gists_url":"https://api.github.com/users/skofman1/gists{/gist_id}","starred_url":"https://api.github.com/users/skofman1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skofman1/subscriptions","organizations_url":"https://api.github.com/users/skofman1/orgs","repos_url":"https://api.github.com/users/skofman1/repos","events_url":"https://api.github.com/users/skofman1/events{/privacy}","received_events_url":"https://api.github.com/users/skofman1/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/NuGet/ServerCommon/pulls/70/commits","review_comments_url":"https://api.github.com/repos/NuGet/ServerCommon/pulls/70/comments","review_comment_url":"https://api.github.com/repos/NuGet/ServerCommon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NuGet/ServerCommon/issues/70/comments","statuses_url":"https://api.github.com/repos/NuGet/ServerCommon/statuses/761e5691281919de30365754caa5d6e84f183349","head":{"label":"NuGet:loshar-servicebus","ref":"loshar-servicebus","sha":"761e5691281919de30365754caa5d6e84f183349","user":{"login":"NuGet","id":968310,"avatar_url":"https://avatars2.githubusercontent.com/u/968310?v=4","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"repo":{"id":66957007,"name":"ServerCommon","full_name":"NuGet/ServerCommon","owner":{"login":"NuGet","id":968310,"avatar_url":"https://avatars2.githubusercontent.com/u/968310?v=4","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NuGet/ServerCommon","description":"Common libraries used across the server repos","fork":false,"url":"https://api.github.com/repos/NuGet/ServerCommon","forks_url":"https://api.github.com/repos/NuGet/ServerCommon/forks","keys_url":"https://api.github.com/repos/NuGet/ServerCommon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NuGet/ServerCommon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NuGet/ServerCommon/teams","hooks_url":"https://api.github.com/repos/NuGet/ServerCommon/hooks","issue_events_url":"https://api.github.com/repos/NuGet/ServerCommon/issues/events{/number}","events_url":"https://api.github.com/repos/NuGet/ServerCommon/events","assignees_url":"https://api.github.com/repos/NuGet/ServerCommon/assignees{/user}","branches_url":"https://api.github.com/repos/NuGet/ServerCommon/branches{/branch}","tags_url":"https://api.github.com/repos/NuGet/ServerCommon/tags","blobs_url":"https://api.github.com/repos/NuGet/ServerCommon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NuGet/ServerCommon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NuGet/ServerCommon/git/refs{/sha}","trees_url":"https://api.github.com/repos/NuGet/ServerCommon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NuGet/ServerCommon/statuses/{sha}","languages_url":"https://api.github.com/repos/NuGet/ServerCommon/languages","stargazers_url":"https://api.github.com/repos/NuGet/ServerCommon/stargazers","contributors_url":"https://api.github.com/repos/NuGet/ServerCommon/contributors","subscribers_url":"https://api.github.com/repos/NuGet/ServerCommon/subscribers","subscription_url":"https://api.github.com/repos/NuGet/ServerCommon/subscription","commits_url":"https://api.github.com/repos/NuGet/ServerCommon/commits{/sha}","git_commits_url":"https://api.github.com/repos/NuGet/ServerCommon/git/commits{/sha}","comments_url":"https://api.github.com/repos/NuGet/ServerCommon/comments{/number}","issue_comment_url":"https://api.github.com/repos/NuGet/ServerCommon/issues/comments{/number}","contents_url":"https://api.github.com/repos/NuGet/ServerCommon/contents/{+path}","compare_url":"https://api.github.com/repos/NuGet/ServerCommon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NuGet/ServerCommon/merges","archive_url":"https://api.github.com/repos/NuGet/ServerCommon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NuGet/ServerCommon/downloads","issues_url":"https://api.github.com/repos/NuGet/ServerCommon/issues{/number}","pulls_url":"https://api.github.com/repos/NuGet/ServerCommon/pulls{/number}","milestones_url":"https://api.github.com/repos/NuGet/ServerCommon/milestones{/number}","notifications_url":"https://api.github.com/repos/NuGet/ServerCommon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NuGet/ServerCommon/labels{/name}","releases_url":"https://api.github.com/repos/NuGet/ServerCommon/releases{/id}","deployments_url":"https://api.github.com/repos/NuGet/ServerCommon/deployments","created_at":"2016-08-30T16:10:36Z","updated_at":"2017-09-26T13:56:11Z","pushed_at":"2017-10-11T20:27:04Z","git_url":"git://github.com/NuGet/ServerCommon.git","ssh_url":"git@github.com:NuGet/ServerCommon.git","clone_url":"https://github.com/NuGet/ServerCommon.git","svn_url":"https://github.com/NuGet/ServerCommon","homepage":null,"size":700,"stargazers_count":6,"watchers_count":6,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":6,"default_branch":"master"}},"base":{"label":"NuGet:dev","ref":"dev","sha":"2b041710226f6ff3959d243b047ba64ab7db9a9b","user":{"login":"NuGet","id":968310,"avatar_url":"https://avatars2.githubusercontent.com/u/968310?v=4","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"repo":{"id":66957007,"name":"ServerCommon","full_name":"NuGet/ServerCommon","owner":{"login":"NuGet","id":968310,"avatar_url":"https://avatars2.githubusercontent.com/u/968310?v=4","gravatar_id":"","url":"https://api.github.com/users/NuGet","html_url":"https://github.com/NuGet","followers_url":"https://api.github.com/users/NuGet/followers","following_url":"https://api.github.com/users/NuGet/following{/other_user}","gists_url":"https://api.github.com/users/NuGet/gists{/gist_id}","starred_url":"https://api.github.com/users/NuGet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NuGet/subscriptions","organizations_url":"https://api.github.com/users/NuGet/orgs","repos_url":"https://api.github.com/users/NuGet/repos","events_url":"https://api.github.com/users/NuGet/events{/privacy}","received_events_url":"https://api.github.com/users/NuGet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NuGet/ServerCommon","description":"Common libraries used across the server repos","fork":false,"url":"https://api.github.com/repos/NuGet/ServerCommon","forks_url":"https://api.github.com/repos/NuGet/ServerCommon/forks","keys_url":"https://api.github.com/repos/NuGet/ServerCommon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NuGet/ServerCommon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NuGet/ServerCommon/teams","hooks_url":"https://api.github.com/repos/NuGet/ServerCommon/hooks","issue_events_url":"https://api.github.com/repos/NuGet/ServerCommon/issues/events{/number}","events_url":"https://api.github.com/repos/NuGet/ServerCommon/events","assignees_url":"https://api.github.com/repos/NuGet/ServerCommon/assignees{/user}","branches_url":"https://api.github.com/repos/NuGet/ServerCommon/branches{/branch}","tags_url":"https://api.github.com/repos/NuGet/ServerCommon/tags","blobs_url":"https://api.github.com/repos/NuGet/ServerCommon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NuGet/ServerCommon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NuGet/ServerCommon/git/refs{/sha}","trees_url":"https://api.github.com/repos/NuGet/ServerCommon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NuGet/ServerCommon/statuses/{sha}","languages_url":"https://api.github.com/repos/NuGet/ServerCommon/languages","stargazers_url":"https://api.github.com/repos/NuGet/ServerCommon/stargazers","contributors_url":"https://api.github.com/repos/NuGet/ServerCommon/contributors","subscribers_url":"https://api.github.com/repos/NuGet/ServerCommon/subscribers","subscription_url":"https://api.github.com/repos/NuGet/ServerCommon/subscription","commits_url":"https://api.github.com/repos/NuGet/ServerCommon/commits{/sha}","git_commits_url":"https://api.github.com/repos/NuGet/ServerCommon/git/commits{/sha}","comments_url":"https://api.github.com/repos/NuGet/ServerCommon/comments{/number}","issue_comment_url":"https://api.github.com/repos/NuGet/ServerCommon/issues/comments{/number}","contents_url":"https://api.github.com/repos/NuGet/ServerCommon/contents/{+path}","compare_url":"https://api.github.com/repos/NuGet/ServerCommon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NuGet/ServerCommon/merges","archive_url":"https://api.github.com/repos/NuGet/ServerCommon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NuGet/ServerCommon/downloads","issues_url":"https://api.github.com/repos/NuGet/ServerCommon/issues{/number}","pulls_url":"https://api.github.com/repos/NuGet/ServerCommon/pulls{/number}","milestones_url":"https://api.github.com/repos/NuGet/ServerCommon/milestones{/number}","notifications_url":"https://api.github.com/repos/NuGet/ServerCommon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NuGet/ServerCommon/labels{/name}","releases_url":"https://api.github.com/repos/NuGet/ServerCommon/releases{/id}","deployments_url":"https://api.github.com/repos/NuGet/ServerCommon/deployments","created_at":"2016-08-30T16:10:36Z","updated_at":"2017-09-26T13:56:11Z","pushed_at":"2017-10-11T20:27:04Z","git_url":"git://github.com/NuGet/ServerCommon.git","ssh_url":"git@github.com:NuGet/ServerCommon.git","clone_url":"https://github.com/NuGet/ServerCommon.git","svn_url":"https://github.com/NuGet/ServerCommon","homepage":null,"size":700,"stargazers_count":6,"watchers_count":6,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NuGet/ServerCommon/pulls/70"},"html":{"href":"https://github.com/NuGet/ServerCommon/pull/70"},"issue":{"href":"https://api.github.com/repos/NuGet/ServerCommon/issues/70"},"comments":{"href":"https://api.github.com/repos/NuGet/ServerCommon/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/NuGet/ServerCommon/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/NuGet/ServerCommon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NuGet/ServerCommon/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/NuGet/ServerCommon/statuses/761e5691281919de30365754caa5d6e84f183349"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"loic-sharma"}}