Skip to content

Commit

Permalink
Fix JSON deserialization issue (#53)
Browse files Browse the repository at this point in the history
* Added ClosedBy clas

* Changed ClosedBy type from string to ClosedBy class
  • Loading branch information
dnagl authored and nmklotas committed Sep 18, 2019
1 parent fa9198a commit fabca1f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
28 changes: 28 additions & 0 deletions src/GitLabApiClient/Models/Issues/Responses/ClosedBy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;

namespace GitLabApiClient.Models.Issues.Responses
{
public sealed class ClosedBy : ModifiableObject
{
[JsonProperty("active")]
public string State;

[JsonProperty("web_url")]
public string WebUrl;

[JsonProperty("avatar_url")]
public string AvatarUrl;

[JsonProperty("username")]
public string Username;

[JsonProperty("id")]
public string Id;

[JsonProperty("name")]
public string Name;
}
}
2 changes: 1 addition & 1 deletion src/GitLabApiClient/Models/Issues/Responses/Issue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public sealed class Issue : ModifiableObject
public DateTime? ClosedAt { get; set; }

[JsonProperty("closed_by")]
public string ClosedBy { get; set; }
public ClosedBy ClosedBy { get; set; }

[JsonProperty("title")]
public string Title { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using GitLabApiClient.Models.Issues.Responses;
using GitLabApiClient.Models.Milestones.Responses;
using Newtonsoft.Json;

Expand Down Expand Up @@ -62,7 +63,7 @@ public sealed class MergeRequest : ModifiableObject
public DateTime? ClosedAt { get; set; }

[JsonProperty("closed_by")]
public string ClosedBy { get; set; }
public ClosedBy ClosedBy { get; set; }

[JsonProperty("target_branch")]
public string TargetBranch { get; set; }
Expand Down

0 comments on commit fabca1f

Please sign in to comment.