using Microsoft.AspNetCore.Http.HttpResults; var builder = WebApplication.CreateBuilder(args); builder.Services.AddProblemDetails(); var app = builder.Build(); app.MapGet("/items/{id:int}", Results, NotFound, ProblemHttpResult> (int id) => { if (id <= 0) return TypedResults.Problem(statusCode: 400, title: "Identifier must be positive"); return id == 1 ? TypedResults.Ok(new Item(1, "rune")) : TypedResults.NotFound(); }); app.Run(); public sealed record Item(int Id, string Name);