#define RGG4F // RGG4 RGG4F #if NEVER #elif RGG4 // using System.Text.Json.Serialization; var builder = WebApplication.CreateSlimBuilder(args); builder.Services.ConfigureHttpJsonOptions(options => { options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default); }); var app = builder.Build(); app.MapGet("/v1/todos", () => new { Id = 1, Task = "Write tests" }); app.Run(); record Todo(int Id, string Task); [JsonSerializable(typeof(Todo[]))] internal partial class AppJsonSerializerContext : JsonSerializerContext { } // #elif RGG4F // using System.Text.Json.Serialization; var builder = WebApplication.CreateSlimBuilder(args); builder.Services.ConfigureHttpJsonOptions(options => { options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default); }); var app = builder.Build(); app.MapGet("/v1/todos", () => new Todo(1, "Write tests fix")); app.Run(); record Todo(int Id, string Task); [JsonSerializable(typeof(Todo[]))] internal partial class AppJsonSerializerContext : JsonSerializerContext { } // #endif