Skip to content

Commit b62e793

Browse files
Refactor JSON serialization and simplify enum handling
Simplified `GameType` enum in `CreateGameRequest.cs` by removing conditional compilation and redundant `JsonConverter` attributes. Compatibility with .NET 7 is no longer required.
1 parent 450d7ef commit b62e793

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

src/clients/Codebreaker.GameAPIs.Client/GamesClient.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ public async Task<IEnumerable<GameInfo>> GetGamesAsync(GamesQuery query, Cancell
215215
}
216216
}
217217

218-
219218
[JsonSourceGenerationOptions(WriteIndented = true, PropertyNameCaseInsensitive = true)]
220219
[JsonSerializable(typeof(CreateGameRequest))]
221220
[JsonSerializable(typeof(CreateGameResponse))]
@@ -232,4 +231,4 @@ public async Task<IEnumerable<GameInfo>> GetGamesAsync(GamesQuery query, Cancell
232231
internal partial class GamesClientJsonContext : JsonSerializerContext
233232
{
234233

235-
}
234+
}

src/clients/Codebreaker.GameAPIs.Client/Models/CreateGameRequest.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ namespace Codebreaker.GameAPIs.Client.Models;
55
/// <summary>
66
/// The list of possible game types
77
/// </summary>
8-
#if NET8_0_OR_GREATER
98
[JsonConverter(typeof(JsonStringEnumConverter<GameType>))]
10-
#else
11-
[JsonConverter(typeof(JsonStringEnumConverter))]
12-
#endif
139
public enum GameType
1410
{
1511
Game6x4,

0 commit comments

Comments
 (0)