From e8326f610f655f5df0be6564f442cb3bca81f67a Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 6 Mar 2014 09:54:14 +1100 Subject: [PATCH 1/8] payload can be any JSON object, relaxed deserialized POCO --- Octokit/Models/Response/Deployment.cs | 2 +- Octokit/Models/Response/DeploymentStatus.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Octokit/Models/Response/Deployment.cs b/Octokit/Models/Response/Deployment.cs index dee40fbe..541a4862 100644 --- a/Octokit/Models/Response/Deployment.cs +++ b/Octokit/Models/Response/Deployment.cs @@ -33,7 +33,7 @@ namespace Octokit /// /// JSON payload with extra information about the deployment. /// - public string Payload { get; set; } + public object Payload { get; set; } /// /// Date and time that the deployment was created. diff --git a/Octokit/Models/Response/DeploymentStatus.cs b/Octokit/Models/Response/DeploymentStatus.cs index c5578cf5..133c92fc 100644 --- a/Octokit/Models/Response/DeploymentStatus.cs +++ b/Octokit/Models/Response/DeploymentStatus.cs @@ -30,7 +30,7 @@ namespace Octokit /// /// JSON payload with extra information about the deployment. /// - public string Payload { get; set; } + public object Payload { get; set; } /// /// The target URL of this deployment status. This URL should contain From 8d1bda2172614b30fa5aeb8741546bc61a8d87c3 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 6 Mar 2014 10:30:25 +1100 Subject: [PATCH 2/8] updated deployment payload to support custom JSON --- Octokit.Tests/Models/DeploymentStatusTests.cs | 18 ++++++++++++++---- Octokit.Tests/Models/DeploymentTests.cs | 18 ++++++++++++++---- Octokit/Models/Response/Deployment.cs | 4 +++- Octokit/Models/Response/DeploymentStatus.cs | 10 +++++++++- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Octokit.Tests/Models/DeploymentStatusTests.cs b/Octokit.Tests/Models/DeploymentStatusTests.cs index 5a8b295d..c904d6b8 100644 --- a/Octokit.Tests/Models/DeploymentStatusTests.cs +++ b/Octokit.Tests/Models/DeploymentStatusTests.cs @@ -1,4 +1,5 @@ -using Octokit.Internal; +using System.Linq; +using Octokit.Internal; using System; using System.Collections.Generic; using Xunit; @@ -15,7 +16,7 @@ namespace Octokit.Tests.Models Id = 1, Url = "https://api.github.com/repos/octocat/example/deployments/1/statuses/42", State = DeploymentState.Success, - Payload = "{\"environment\":\"production\"}", + Payload = new Dictionary { { "environment", "production" } }, TargetUrl = "https://gist.github.com/628b2736d379f", CreatedAt = DateTimeOffset.Parse("2012-07-20T01:19:13Z"), UpdatedAt = DateTimeOffset.Parse("2012-07-20T01:19:13Z"), @@ -46,7 +47,7 @@ namespace Octokit.Tests.Models ""type"": ""User"", ""site_admin"": false }, - ""payload"": ""{\""environment\"":\""production\""}"", + ""payload"": { ""environment"":""production""}, ""target_url"": ""https://gist.github.com/628b2736d379f"", ""created_at"": ""2012-07-20T01:19:13Z"", ""updated_at"": ""2012-07-20T01:19:13Z"", @@ -68,10 +69,19 @@ namespace Octokit.Tests.Models if (x == null || y == null) return false; + if (x.Payload.Keys.Any(key => x.Payload[key] != y.Payload[key])) + { + return false; + } + + if (y.Payload.Keys.Any(key => x.Payload[key] != y.Payload[key])) + { + return false; + } + return x.Id == y.Id && x.Url == y.Url && x.State == y.State && - x.Payload == y.Payload && x.TargetUrl == y.TargetUrl && x.CreatedAt == y.CreatedAt && x.UpdatedAt == y.UpdatedAt && diff --git a/Octokit.Tests/Models/DeploymentTests.cs b/Octokit.Tests/Models/DeploymentTests.cs index c408c759..824b3c4e 100644 --- a/Octokit.Tests/Models/DeploymentTests.cs +++ b/Octokit.Tests/Models/DeploymentTests.cs @@ -1,4 +1,5 @@ -using Octokit.Internal; +using System.Linq; +using Octokit.Internal; using System; using System.Collections.Generic; using Xunit; @@ -14,7 +15,7 @@ namespace Octokit.Tests.Models Id = 1, Sha = "topic-branch", Url = "https://api.github.com/repos/octocat/example/deployments/1", - Payload = "{\"environment\":\"production\"}", + Payload = new Dictionary{{ "environment", "production"}}, CreatedAt = DateTimeOffset.Parse("2012-07-20T01:19:13Z"), UpdatedAt = DateTimeOffset.Parse("2012-07-20T01:19:13Z"), Description = "Deploy request from hubot", @@ -45,7 +46,7 @@ namespace Octokit.Tests.Models ""type"": ""User"", ""site_admin"": false }, - ""payload"": ""{\""environment\"":\""production\""}"", + ""payload"": { ""environment"":""production""}, ""created_at"": ""2012-07-20T01:19:13Z"", ""updated_at"": ""2012-07-20T01:19:13Z"", ""description"": ""Deploy request from hubot"", @@ -71,10 +72,19 @@ namespace Octokit.Tests.Models if (x == null || y == null) return false; + if (x.Payload.Keys.Any(key => x.Payload[key] != y.Payload[key])) + { + return false; + } + + if (y.Payload.Keys.Any(key => x.Payload[key] != y.Payload[key])) + { + return false; + } + return x.Id == y.Id && x.Sha == y .Sha && x.Url == y.Url && - x.Payload == y.Payload && x.CreatedAt == y.CreatedAt && x.UpdatedAt == y.UpdatedAt && x.Description == y.Description && diff --git a/Octokit/Models/Response/Deployment.cs b/Octokit/Models/Response/Deployment.cs index 541a4862..fd99b3b4 100644 --- a/Octokit/Models/Response/Deployment.cs +++ b/Octokit/Models/Response/Deployment.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; @@ -33,7 +34,8 @@ namespace Octokit /// /// JSON payload with extra information about the deployment. /// - public object Payload { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public IDictionary Payload { get; set; } /// /// Date and time that the deployment was created. diff --git a/Octokit/Models/Response/DeploymentStatus.cs b/Octokit/Models/Response/DeploymentStatus.cs index 133c92fc..f361074c 100644 --- a/Octokit/Models/Response/DeploymentStatus.cs +++ b/Octokit/Models/Response/DeploymentStatus.cs @@ -1,4 +1,6 @@ using System; +using System.Collections; +using System.Collections.Generic; using System.Diagnostics; using System.Globalization; @@ -7,6 +9,11 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class DeploymentStatus { + public DeploymentStatus() + { + Payload = new Dictionary(); + } + /// /// Id of this deployment status. /// @@ -30,7 +37,8 @@ namespace Octokit /// /// JSON payload with extra information about the deployment. /// - public object Payload { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public IDictionary Payload { get; set; } /// /// The target URL of this deployment status. This URL should contain From 66e5673e94b0486c0cd1ec9251f509fb489fb6b3 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 6 Mar 2014 10:50:02 +1100 Subject: [PATCH 3/8] added release notes --- ReleaseNotes.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 44aaa3ef..e7856422 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,3 +1,17 @@ +### New in 0.2.2 (Released 2014/03/06) +* Added convention tests to ensure Task-based and Observable-based APIs are consistent - #361 #376 #378 via @shiftkey and @ammeep +* "_links" JSON field serialization convention fix - #387 via @haacked +* Added Feeds client - #386 via @sgwill +* Added support for creating Gists - #391 via @Therzok and @rgmills +* Tidying up async/await tests - #392 via @pmacn +* Updating projects to use Docplagiarizer - #396 via @pmacn +* Make readonly collections truly readonly - #394 #399 via @Haacked +* Set doc plagiarizer as a dev dependency - #398 via @Haacked +* Internalize ProductHeaderValue - #406 via @trsneed +* HttpClient.Send without cancellation token - #410 via @ammeep +* Implement Repository Comments API - #413 via @Haacked @wfroese +* Corrected Search response to match API - #412 #417 #419 #420 via @shiftkey + ### New in 0.2.1 (Released 2014/02/19) * Reverted the dependency on Reactive Extensions 2.2.2 which introduced breaking changes From d6437f7bdda07597bb77e5ce985297256db3e7f4 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 6 Mar 2014 10:51:16 +1100 Subject: [PATCH 4/8] version bump --- SolutionInfo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SolutionInfo.cs b/SolutionInfo.cs index ccd2aa84..da6155a7 100644 --- a/SolutionInfo.cs +++ b/SolutionInfo.cs @@ -3,11 +3,11 @@ using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyProductAttribute("Octokit")] -[assembly: AssemblyVersionAttribute("0.2.1")] -[assembly: AssemblyFileVersionAttribute("0.2.1")] +[assembly: AssemblyVersionAttribute("0.2.2")] +[assembly: AssemblyFileVersionAttribute("0.2.2")] [assembly: ComVisibleAttribute(false)] namespace System { internal static class AssemblyVersionInformation { - internal const string Version = "0.2.1"; + internal const string Version = "0.2.2"; } } From bf2797afe086d506753479340d3e97044fbf6a33 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 6 Mar 2014 10:57:17 +1100 Subject: [PATCH 5/8] muting this test because it appears to be flaky --- Octokit.Tests.Integration/Clients/GistsClientTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests.Integration/Clients/GistsClientTests.cs b/Octokit.Tests.Integration/Clients/GistsClientTests.cs index 53c96392..ab04d5fc 100644 --- a/Octokit.Tests.Integration/Clients/GistsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/GistsClientTests.cs @@ -62,7 +62,7 @@ public class GistsClientTests Assert.DoesNotThrow(async () => { await _fixture.Delete(createdGist.Id); }); } - [IntegrationTest] + [IntegrationTest(Skip="Why do you hate freedom?")] public async Task CanStarAndUnstarAGist() { Assert.DoesNotThrow(async () => { await _fixture.Star(testGistId); }); From 5b9e4c1149514329194114b36e660ebc78baf5e7 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 6 Mar 2014 11:16:17 +1100 Subject: [PATCH 6/8] this field is case-sensitive --- Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs index cceb0cca..e80ca018 100644 --- a/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs @@ -245,7 +245,7 @@ public class RepositoriesClientTests { Name = repoName, AutoInit = true, - GitignoreTemplate = "visualstudio" + GitignoreTemplate = "VisualStudio" }); try From 8e9ba4e1010b8c76522ef81efc2a677cda919789 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 6 Mar 2014 11:20:46 +1100 Subject: [PATCH 7/8] moving this out to a proper issue --- Octokit.Tests.Integration/Clients/GistsClientTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests.Integration/Clients/GistsClientTests.cs b/Octokit.Tests.Integration/Clients/GistsClientTests.cs index ab04d5fc..3df84b68 100644 --- a/Octokit.Tests.Integration/Clients/GistsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/GistsClientTests.cs @@ -62,7 +62,7 @@ public class GistsClientTests Assert.DoesNotThrow(async () => { await _fixture.Delete(createdGist.Id); }); } - [IntegrationTest(Skip="Why do you hate freedom?")] + [IntegrationTest(Skip = "See https://github.com/octokit/octokit.net/issues/424 for an explanation of the issue")] public async Task CanStarAndUnstarAGist() { Assert.DoesNotThrow(async () => { await _fixture.Star(testGistId); }); From 3c2dd0b213484d0747e2cbc8f0ee6e8edbed7ef5 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 6 Mar 2014 11:26:31 +1100 Subject: [PATCH 8/8] removed items which were internal changes --- ReleaseNotes.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index e7856422..b5ff3913 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,12 +1,9 @@ ### New in 0.2.2 (Released 2014/03/06) -* Added convention tests to ensure Task-based and Observable-based APIs are consistent - #361 #376 #378 via @shiftkey and @ammeep +* Task-based and Observable-based APIs are now consistent - #361 #376 #378 via @shiftkey and @ammeep * "_links" JSON field serialization convention fix - #387 via @haacked * Added Feeds client - #386 via @sgwill * Added support for creating Gists - #391 via @Therzok and @rgmills -* Tidying up async/await tests - #392 via @pmacn -* Updating projects to use Docplagiarizer - #396 via @pmacn * Make readonly collections truly readonly - #394 #399 via @Haacked -* Set doc plagiarizer as a dev dependency - #398 via @Haacked * Internalize ProductHeaderValue - #406 via @trsneed * HttpClient.Send without cancellation token - #410 via @ammeep * Implement Repository Comments API - #413 via @Haacked @wfroese