© 2026 Hedgehog Software, LLC
[BsonCollection("product_categories")] public class ProductCategory { [BsonId(IdGenerator = typeof(StringObjectIdGenerator))] [BsonRepresentation(BsonType.ObjectId)] public string Id { get; set; } = null!; [BsonElement("name")] [BsonRequired] public required string Name { get; set; } [BsonElement("icon")] public ImageAsset? Icon { get; set; } [BsonElement("schema")] [BsonExtraElements] public required BsonDocument Schema { get; set; } [BsonElement("is_active")] public bool IsActive { get; set; } [BsonElement("created_at")] [BsonRequired] public DateTime CreatedAt { get; set; } [BsonElement("updated_at")] [BsonRequired] public DateTime UpdatedAt { get; set; } }
System.InvalidOperationException: The depth of the generated JSON schema exceeds the JsonSerializerOptions.MaxDepth setting.
Scalar.AspNetCore
MapOpenApi
builder.Services.AddControllers().AddJsonOptions(options => { options.JsonSerializerOptions.MaxDepth = 256; options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; });