This commit is contained in:
2020-01-30 00:45:32 +00:00
parent ef0ee9067f
commit 039427ac56

View File

@@ -73,7 +73,7 @@ namespace AyaNova.DataList
//Has a Enumtype?
if (!string.IsNullOrEmpty(o.EnumType))
sb.Append($",\"et\":\"{o.EnumType}\"");
sb.Append($",\"et\":\"{TrimTypeName(o.EnumType)}\"");
sb.Append("}");
@@ -84,6 +84,17 @@ namespace AyaNova.DataList
return JArray.Parse(sb.ToString());
}
//used to trim an enum type down to only it's most relevant (rightmost) portion
private string TrimTypeName(string str)
{
if (str.Contains('.'))
{
return str.Substring(str.LastIndexOf('.') + 1);
}
return str;
}
//make sure the template parses and all the fields specified are really existant
//this is more for dev errors or api users becuase the client shouldn't generate bad templates
public bool ValidateTemplate(string template)