using System.Text.Json.Serialization; using OptixServe.Api.Dtos; namespace OptixServe.Api.Endpoints; [JsonSerializable(typeof(UserDto))] [JsonSerializable(typeof(IEnumerable))] public partial class UserJsonContext : JsonSerializerContext { } public static class UserEndpoint { public static IEnumerable GetUsers() { return [ new() {Id="1234", UserName = "xxx"}, new() {Id="5678", UserName = "yyy"}, ]; } public static void Register(WebApplication app) { var group = app.MapGroup("/users"); group.MapGet("/", GetAllUsers); } public static IResult GetAllUsers() { return Results.Ok(GetUsers()); } }