Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Adyen/ReportWebhooks/Models/ReportNotificationRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private TypeEnum(string? value)
if (value == TypeEnum.BalancePlatformReportCreated)
return "balancePlatform.report.created";

return null;
return value.Value;
}

/// <summary>
Expand Down Expand Up @@ -264,7 +264,7 @@ public override ReportNotificationRequest Read(ref Utf8JsonReader utf8JsonReader
break;
case "type":
string? typeRawValue = utf8JsonReader.GetString();
type = new Option<ReportNotificationRequest.TypeEnum?>(ReportNotificationRequest.TypeEnum.FromStringOrDefault(typeRawValue));
type = new Option<ReportNotificationRequest.TypeEnum?>(ReportNotificationRequest.TypeEnum.FromStringOrDefault(typeRawValue) ?? (ReportNotificationRequest.TypeEnum)typeRawValue);
Comment on lines 266 to +267

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The typeRawValue variable is of type string?, but it is passed to FromStringOrDefault which expects a non-nullable string. This triggers a compiler warning (CS8604) in a #nullable enable context. Additionally, this manual deserialization logic is redundant because it is already implemented in the TypeEnumJsonConverter. You can simplify this by leveraging JsonSerializer.Deserialize directly, which is more maintainable and avoids the nullability issue.

                            type = new Option<ReportNotificationRequest.TypeEnum?>(JsonSerializer.Deserialize<ReportNotificationRequest.TypeEnum>(ref utf8JsonReader, jsonSerializerOptions));

break;
case "timestamp":
timestamp = new Option<DateTimeOffset?>(JsonSerializer.Deserialize<DateTimeOffset>(ref utf8JsonReader, jsonSerializerOptions));
Expand All @@ -287,7 +287,7 @@ public override ReportNotificationRequest Read(ref Utf8JsonReader utf8JsonReader
var reportNotificationRequest = new ReportNotificationRequest();
reportNotificationRequest.Data = data.Value!;
reportNotificationRequest.Environment = environment.Value!;
reportNotificationRequest.Type = type.Value!.Value;
reportNotificationRequest.Type = type.Value!;
if (timestamp.IsSet)
reportNotificationRequest.Timestamp = timestamp.Value;
return reportNotificationRequest;
Expand Down
8 changes: 4 additions & 4 deletions sdk-generation-log/reportwebhooks.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"service": "reportwebhooks",
"project": "dotnet",
"generatedAt": "2026-05-12T08:06:02Z",
"openapiCommitSha": "c17deb734dee105f2d25e50825bed55fdbd71c50",
"automationCommitSha": "0b7ef4e0ed6a7963ab005efe76eab748250edafc",
"libraryCommitSha": "ed5b5b7be2fa4a88becfee9716bba894bdfe61b6"
"generatedAt": "2026-05-21T12:55:15Z",
"openapiCommitSha": "e5eedc5cba69416331333d4b0e90cb4871715517",
"automationCommitSha": "6f06b47d0661f0891defe6b85461d2c367fbd284",
"libraryCommitSha": "73a83cb23fb8e432b81d23291bd9be4e7fcc0d2f"
}
Loading