Need to fix index load issues
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SVSim.Database;
|
||||
@@ -22,10 +23,16 @@ public class Program
|
||||
|
||||
builder.Services.AddControllers().AddJsonOptions(opt =>
|
||||
{
|
||||
// Wire-format congruence: the encrypted msgpack path uses snake_case [Key("...")]
|
||||
// names; the plain-JSON path runs through System.Text.Json. Match them by using
|
||||
// SnakeCaseLower naming policy here so both paths emit identical key names — and
|
||||
// so the translation middleware can hand JSON keys straight through to msgpack
|
||||
// without per-property name remapping.
|
||||
opt.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower;
|
||||
// Production omits null/optional fields entirely; the client uses
|
||||
// `Keys.Contains(name)` as a presence check and calls `.ToInt()` (etc.) on the
|
||||
// value without a null guard. Emitting `"key":null` makes Contains return true and
|
||||
// crashes the client. Match prod by dropping nulls during serialization.
|
||||
// crashes the client. Drop nulls during serialization so missing == absent.
|
||||
opt.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
|
||||
});
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
|
||||
Reference in New Issue
Block a user