OnChallenge
OnAuthenticationFailed
BsonJsonConverter
public class BsonJsonConverter : JsonConverter<BsonDocument>{ public override BsonDocument? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return BsonDocument.Parse(reader.GetString()); } public override void Write(Utf8JsonWriter writer, BsonDocument value, JsonSerializerOptions options) { writer.WriteRawValue(value.ToJson()); }}
[BsonElement("schema")] [JsonConverter(typeof(BsonJsonConverter))] public required BsonDocument Schema { get; set; }
builder.Services.Configure<JsonOptions>(o =>{ o.SerializerOptions.MaxDepth = 256; o.SerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; o.SerializerOptions.Converters.Add(new BsonJsonConverter());});
[11:11:33 ERR] HTTP GET /openapi/v1.json responded 500 in 269.2645 ms <s:Serilog.AspNetCore.RequestLoggingMiddleware>