Deck list work
This commit is contained in:
26
SVSim.EmulatedEntrypoint/Infrastructure/JsonbReadOptions.cs
Normal file
26
SVSim.EmulatedEntrypoint/Infrastructure/JsonbReadOptions.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SVSim.EmulatedEntrypoint.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Shared System.Text.Json options for deserializing jsonb-passthrough columns into typed DTOs.
|
||||
///
|
||||
/// The prod-captured globals JSON was seeded with snake_case_lower keys (see SVSim.Bootstrap
|
||||
/// GlobalsImporter — jsonb columns store the original capture verbatim). Deserialize-back must
|
||||
/// use the same naming policy so e.g. `card_pool_name` maps onto `CardPoolName`.
|
||||
///
|
||||
/// AllowReadingFromString handles prod's PHP-backend convention of emitting numeric values
|
||||
/// as JSON strings (e.g. `"ability_id": "1"`). Numeric-typed DTO properties accept those.
|
||||
///
|
||||
/// Used by LoadController and MyPageController (and any other controller that reads jsonb).
|
||||
/// </summary>
|
||||
public static class JsonbReadOptions
|
||||
{
|
||||
public static readonly JsonSerializerOptions Instance = new()
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
|
||||
PropertyNameCaseInsensitive = false,
|
||||
NumberHandling = JsonNumberHandling.AllowReadingFromString,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user