Slice A3b: Convert InitiateShadowRunRequest to class with JsonPropertyName
- Change from record to class (better JsonPropertyName support) - Add [JsonPropertyName] attributes for camelCase JSON deserialization - Properties: modelId, windowStart, windowEnd, phaseFilter - Resolves 400 Bad Request validation failures Source: FastEndpoints + System.Text.Json deserialization best practice Decision: Class-based DTO with explicit property mapping Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,12 +5,17 @@ namespace KArtSell.Host.Features.ShadowRun;
|
||||
/// <summary>
|
||||
/// Initiate a 252+ trading-day model validation run.
|
||||
/// </summary>
|
||||
public sealed record InitiateShadowRunRequest(
|
||||
[property: JsonPropertyName("modelId")]
|
||||
Guid ModelId,
|
||||
[property: JsonPropertyName("windowStart")]
|
||||
DateOnly WindowStart,
|
||||
[property: JsonPropertyName("windowEnd")]
|
||||
DateOnly WindowEnd,
|
||||
[property: JsonPropertyName("phaseFilter")]
|
||||
string PhaseFilter = "All");
|
||||
public sealed class InitiateShadowRunRequest
|
||||
{
|
||||
[JsonPropertyName("modelId")]
|
||||
public Guid ModelId { get; set; }
|
||||
|
||||
[JsonPropertyName("windowStart")]
|
||||
public DateOnly WindowStart { get; set; }
|
||||
|
||||
[JsonPropertyName("windowEnd")]
|
||||
public DateOnly WindowEnd { get; set; }
|
||||
|
||||
[JsonPropertyName("phaseFilter")]
|
||||
public string PhaseFilter { get; set; } = "All";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user