Added response model for post put and patch call
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user