From 9c3241cea459d103616afd95b0317b7835a12dc5 Mon Sep 17 00:00:00 2001 From: Ankitkumar Satapara Date: Sat, 18 Apr 2026 23:30:55 +0530 Subject: [PATCH] Fixed issues on take node which is not working on the list of response class for get apis --- .../Nodify.Calculator/CalculatorViewModel.cs | 16 +++++++++++----- .../Operations/OperationFactory.cs | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Examples/Nodify.Calculator/CalculatorViewModel.cs b/Examples/Nodify.Calculator/CalculatorViewModel.cs index 7254cf0..47e62b5 100644 --- a/Examples/Nodify.Calculator/CalculatorViewModel.cs +++ b/Examples/Nodify.Calculator/CalculatorViewModel.cs @@ -452,15 +452,21 @@ namespace Nodify.Calculator takeListInput.ConnectorColor = sourceConnector.RawColor; takeListInput.DataType = sourceConnector.DataType; - // Determine the element type from a list type (e.g. "list" -> "int") + // Determine the element type from a list type (e.g. "List" -> "ClassName") var elementType = sourceConnector.DataType ?? ""; - if (elementType.StartsWith("list<") && elementType.EndsWith(">")) + if (elementType.StartsWith("List<", System.StringComparison.OrdinalIgnoreCase) && elementType.EndsWith(">")) { elementType = elementType.Substring(5, elementType.Length - 6); } var elementColor = ConnectorViewModel.GetColorForType(elementType); + // Check if the element type is a model class (has a .cs file in CustomModels) + bool isModelType = false; + var modelFilePath = Path.Combine("CustomModels", $"{elementType}.cs"); + if (File.Exists(modelFilePath)) + isModelType = true; + // Remove existing outputs var toRemove = takeOp.Output.ToList(); toRemove.ForEach(o => @@ -469,13 +475,13 @@ namespace Nodify.Calculator takeOp.Output.Remove(o); }); - // Add single output for the element type + // Add single output for the element type — use Square shape for model types takeOp.Output.Add(new ConnectorViewModel { Title = "Element", IsInput = false, - Shape = ConnectorShape.Circle, - ConnectorColor = elementColor, + Shape = isModelType ? ConnectorShape.Square : ConnectorShape.Circle, + ConnectorColor = isModelType ? System.Drawing.Color.MediumPurple : elementColor, DataType = elementType }); } diff --git a/Examples/Nodify.Calculator/Operations/OperationFactory.cs b/Examples/Nodify.Calculator/Operations/OperationFactory.cs index 48e066b..a05bec5 100644 --- a/Examples/Nodify.Calculator/Operations/OperationFactory.cs +++ b/Examples/Nodify.Calculator/Operations/OperationFactory.cs @@ -279,7 +279,7 @@ namespace Nodify.Calculator IsInput = false, Shape = ConnectorShape.Square, ConnectorColor = Color.MediumPurple, - DataType = responseClassName.ToLower() + DataType = responseClassName }); } else