Implemented Direct model creation when swagger file is imported to the list
This commit is contained in:
@@ -249,7 +249,8 @@ namespace Nodify.Calculator
|
||||
var _o = new APIOperationViewModel
|
||||
{
|
||||
Title = info.Title,
|
||||
OperationType = info.OPType.ToUpper()
|
||||
OperationType = info.OPType.ToUpper(),
|
||||
ResponseModelClassName = info.ResponseModelClassName ?? string.Empty
|
||||
};
|
||||
var connectorViewModel = new ConnectorViewModel()
|
||||
{
|
||||
@@ -263,14 +264,43 @@ namespace Nodify.Calculator
|
||||
IsInput = false
|
||||
};
|
||||
_o.Output.Add(connectorViewModel2);
|
||||
_o.Output.Add(new ConnectorViewModel { ConnectorColor = Color.LimeGreen });
|
||||
|
||||
// Add typed response output based on ResponseModelClassName
|
||||
if (!string.IsNullOrEmpty(info.ResponseModelClassName))
|
||||
{
|
||||
var responseClassName = info.ResponseModelClassName;
|
||||
bool isList = responseClassName.StartsWith("List<") && responseClassName.EndsWith(">");
|
||||
var innerType = isList ? responseClassName.Substring(5, responseClassName.Length - 6) : responseClassName;
|
||||
|
||||
// Square connector for model output
|
||||
_o.Output.Add(new ConnectorViewModel
|
||||
{
|
||||
Title = responseClassName,
|
||||
IsInput = false,
|
||||
Shape = ConnectorShape.Square,
|
||||
ConnectorColor = Color.MediumPurple,
|
||||
DataType = responseClassName.ToLower()
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default: generic object output
|
||||
_o.Output.Add(new ConnectorViewModel
|
||||
{
|
||||
Title = "Response",
|
||||
IsInput = false,
|
||||
Shape = ConnectorShape.Circle,
|
||||
ConnectorColor = Color.LimeGreen,
|
||||
DataType = "object"
|
||||
});
|
||||
}
|
||||
|
||||
_o.Input.Add(connectorViewModel);
|
||||
foreach (var item in input)
|
||||
{
|
||||
item.ConnectorColor = Color.LimeGreen;
|
||||
_o.Input.Add(item);
|
||||
}
|
||||
//_o.Input.AddRange(input);
|
||||
return _o;
|
||||
case OperationType.System:
|
||||
if (info.sysOp == SystemOperations.FUNCTION)
|
||||
|
||||
Reference in New Issue
Block a user