using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; namespace StabilityMatrix.Core.Models.Api.Comfy; public class ComfyInputInfo { [JsonPropertyName("required")] public Dictionary? Required { get; set; } [JsonPropertyName("optional")] public Dictionary? Optional { get; set; } public List? GetRequiredValueAsNestedList(string key) { var value = Required?[key]; var nested = value?.Deserialize>>(); return nested?.SelectMany(x => x).ToList(); } public List? GetOptionalValueAsNestedList(string key) { var value = Optional?[key]; var nested = value?.Deserialize()?[0].Deserialize>(); return nested; } }