Skip to content

Commit a1fd8a3

Browse files
authored
Merge pull request #281 from danger/fix-serialization
fix(core): missed default serialisation values
2 parents 2fc8d07 + ab2ea8a commit a1fd8a3

File tree

2 files changed

+25
-24
lines changed
  • danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/models

2 files changed

+25
-24
lines changed

danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/models/github/GitHub.kt

+24-23
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ enum class GitHubPullRequestState {
6565
data class GitHubPR(
6666
val number: Int,
6767
val title: String,
68-
val body: String?,
68+
val body: String? = null,
6969
val user: GitHubUser,
70-
val assignee: GitHubUser?,
70+
val assignee: GitHubUser? = null,
7171
val assignees: List<GitHubUser>,
7272
@SerialName("created_at") val createdAt: Instant,
7373
@SerialName("updated_at") val updatedAt: Instant,
@@ -78,14 +78,14 @@ data class GitHubPR(
7878
val state: GitHubPullRequestState,
7979
@SerialName("draft") val isDraft: Boolean,
8080
@SerialName("locked") val isLocked: Boolean,
81-
@SerialName("merged") val isMerged: Boolean?,
82-
@SerialName("commits") val commitCount: Int?,
83-
@SerialName("comments") val commentCount: Int?,
84-
@SerialName("review_comments") val reviewCommentCount: Int?,
85-
val additions: Int?,
86-
val deletions: Int?,
87-
@SerialName("changed_files") val changedFiles: Int?,
88-
val milestone: GitHubMilestone?,
81+
@SerialName("merged") val isMerged: Boolean? = null,
82+
@SerialName("commits") val commitCount: Int? = null,
83+
@SerialName("comments") val commentCount: Int? = null,
84+
@SerialName("review_comments") val reviewCommentCount: Int? = null,
85+
val additions: Int? = null,
86+
val deletions: Int? = null,
87+
@SerialName("changed_files") val changedFiles: Int? = null,
88+
val milestone: GitHubMilestone? = null,
8989
@SerialName("html_url") val htmlURL: String
9090
)
9191

@@ -150,7 +150,7 @@ data class GitHubRepo(
150150
val fullName: String,
151151
@SerialName("private")
152152
val isPrivate: Boolean,
153-
val description: String?,
153+
val description: String? = null,
154154
@SerialName("fork")
155155
val isFork: Boolean,
156156
@SerialName("html_url")
@@ -178,10 +178,11 @@ enum class GitHubReviewState {
178178
@Serializable
179179
data class GitHubReview(
180180
val user: GitHubUser,
181-
val id: Long?,
182-
val body: String?,
183-
@SerialName("commit_id") val commitId: String?,
184-
val state: GitHubReviewState?
181+
val id: Long? = null,
182+
val body: String? = null,
183+
@SerialName("commit_id")
184+
val commitId: String? = null,
185+
val state: GitHubReviewState? = null
185186
)
186187

187188
/**
@@ -197,9 +198,9 @@ data class GitHubReview(
197198
data class GitHubCommit(
198199
val sha: String,
199200
val url: String,
200-
val author: GitHubUser?,
201+
val author: GitHubUser? = null,
201202
val commit: GitCommit,
202-
val committer: GitHubUser?
203+
val committer: GitHubUser? = null
203204
)
204205

205206
@Serializable
@@ -248,11 +249,11 @@ data class GitHubIssue(
248249
val user: GitHubUser,
249250
val state: GitHubIssueState,
250251
@SerialName("locked") val isLocked: Boolean,
251-
val body: String?,
252+
val body: String? = null,
252253
@SerialName("comments") val commentCount: Int,
253-
val assignee: GitHubUser?,
254+
val assignee: GitHubUser? = null,
254255
val assignees: List<GitHubUser>,
255-
val milestone: GitHubMilestone?,
256+
val milestone: GitHubMilestone? = null,
256257
@SerialName("created_at") val createdAt: Instant,
257258
@SerialName("updated_at") val updatedAt: Instant,
258259
@SerialName("closed_at") val closedAt: Instant? = null,
@@ -294,9 +295,9 @@ enum class GitHubUserType {
294295
*/
295296
@Serializable
296297
data class GitHubUser(
297-
val id: Long?,
298-
val login: String?,
299-
val type: GitHubUserType?,
298+
val id: Long? = null,
299+
val login: String? = null,
300+
val type: GitHubUserType? = null,
300301
@SerialName("avatar_url")
301302
val avatarUrl: String?
302303
)

danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/models/gitlab/GitLab.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ data class GitLabMergeRequest(
5454
@SerialName("first_deployed_to_production_at")
5555
val firstDeployedToProductionAt: Instant? = null,
5656
@SerialName("force_remove_source_branch")
57-
val forceRemoveSourceBranch: Boolean?,
57+
val forceRemoveSourceBranch: Boolean? = null,
5858
val id: Int,
5959
val iid: Int,
6060
@SerialName("latest_build_finished_at")

0 commit comments

Comments
 (0)