From a284684d15d09996bed5746c6f5c0ccaabb3765e Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Mon, 21 Oct 2024 19:42:22 -0700 Subject: [PATCH] fix: some datetime types should be nullable (#596) --- .../Models/RepositoryRulesetEvent/RepositoryRuleset.cs | 6 ++++-- .../Models/WorkflowJobEvent/WorkflowJob.cs | 7 ++++--- .../Models/WorkflowJobEvent/WorkflowJobStep.cs | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Octokit.Webhooks/Models/RepositoryRulesetEvent/RepositoryRuleset.cs b/src/Octokit.Webhooks/Models/RepositoryRulesetEvent/RepositoryRuleset.cs index 6bd31865..113d3151 100644 --- a/src/Octokit.Webhooks/Models/RepositoryRulesetEvent/RepositoryRuleset.cs +++ b/src/Octokit.Webhooks/Models/RepositoryRulesetEvent/RepositoryRuleset.cs @@ -41,8 +41,10 @@ public sealed record RepositoryRuleset public IReadOnlyCollection? Rules { get; init; } [JsonPropertyName("created_at")] - public string? CreatedAt { get; init; } + [JsonConverter(typeof(NullableDateTimeOffsetConverter))] + public DateTimeOffset? CreatedAt { get; init; } [JsonPropertyName("updated_at")] - public string? UpdatedAt { get; init; } + [JsonConverter(typeof(NullableDateTimeOffsetConverter))] + public DateTimeOffset? UpdatedAt { get; init; } } diff --git a/src/Octokit.Webhooks/Models/WorkflowJobEvent/WorkflowJob.cs b/src/Octokit.Webhooks/Models/WorkflowJobEvent/WorkflowJob.cs index 0a20b789..57c79ca6 100644 --- a/src/Octokit.Webhooks/Models/WorkflowJobEvent/WorkflowJob.cs +++ b/src/Octokit.Webhooks/Models/WorkflowJobEvent/WorkflowJob.cs @@ -60,11 +60,12 @@ public sealed record WorkflowJob public string? RunnerGroupName { get; init; } [JsonPropertyName("started_at")] - [JsonConverter(typeof(DateTimeOffsetConverter))] - public DateTimeOffset StartedAt { get; init; } + [JsonConverter(typeof(NullableDateTimeOffsetConverter))] + public DateTimeOffset? StartedAt { get; init; } [JsonPropertyName("completed_at")] - public string? CompletedAt { get; init; } + [JsonConverter(typeof(NullableDateTimeOffsetConverter))] + public DateTimeOffset? CompletedAt { get; init; } [JsonPropertyName("workflow_name")] public string? WorkflowName { get; init; } diff --git a/src/Octokit.Webhooks/Models/WorkflowJobEvent/WorkflowJobStep.cs b/src/Octokit.Webhooks/Models/WorkflowJobEvent/WorkflowJobStep.cs index e4069039..afaffc1d 100644 --- a/src/Octokit.Webhooks/Models/WorkflowJobEvent/WorkflowJobStep.cs +++ b/src/Octokit.Webhooks/Models/WorkflowJobEvent/WorkflowJobStep.cs @@ -18,8 +18,8 @@ public sealed record WorkflowJobStep public long Number { get; init; } [JsonPropertyName("started_at")] - [JsonConverter(typeof(DateTimeOffsetConverter))] - public DateTimeOffset StartedAt { get; init; } + [JsonConverter(typeof(NullableDateTimeOffsetConverter))] + public DateTimeOffset? StartedAt { get; init; } [JsonPropertyName("completed_at")] [JsonConverter(typeof(NullableDateTimeOffsetConverter))]