Added response model for post put and patch call
Some checks failed
Build / build (push) Has been cancelled

This commit is contained in:
Ankitkumar Satapara
2026-04-22 19:40:36 +05:30
parent 5c61fa1e53
commit 92202921a7
3 changed files with 455 additions and 7 deletions

View File

@@ -89,14 +89,46 @@ namespace Nodify.Calculator.NodeHandlers
{
var rc = info.ResponseModelClassName;
bool isList = rc.StartsWith("List<") && rc.EndsWith(">");
op.Output.Add(new ConnectorViewModel
var primitives = new[] { "string", "int", "double", "float", "bool", "decimal", "long", "datetime" };
var innerType = isList ? rc.Substring(5, rc.Length - 6) : rc;
bool isPrimitive = primitives.Contains(innerType.ToLower());
if (isPrimitive && !isList)
{
Title = rc,
IsInput = false,
Shape = isList ? ConnectorShape.Grid : ConnectorShape.Square,
ConnectorColor = isList ? Color.MediumSpringGreen : Color.MediumPurple,
DataType = rc
});
// Primitive response (e.g. int, string, bool)
op.Output.Add(new ConnectorViewModel
{
Title = rc,
IsInput = false,
Shape = ConnectorShape.Circle,
ConnectorColor = ConnectorViewModel.GetColorForType(rc),
DataType = rc.ToLower()
});
}
else if (isList && isPrimitive)
{
// List of primitives (e.g. List<string>)
op.Output.Add(new ConnectorViewModel
{
Title = rc,
IsInput = false,
Shape = ConnectorShape.Grid,
ConnectorColor = Color.MediumSpringGreen,
DataType = rc
});
}
else
{
// Model or List<Model>
op.Output.Add(new ConnectorViewModel
{
Title = rc,
IsInput = false,
Shape = isList ? ConnectorShape.Grid : ConnectorShape.Square,
ConnectorColor = isList ? Color.MediumSpringGreen : Color.MediumPurple,
DataType = rc
});
}
}
else
{