public static TypeDescription ToHumanName(string typeName, Type type = null) { var desc = _descriptor == null ? new TypeDescription(typeName, "") : _descriptor.Get(typeName); if (type != null && desc.JsonParam == null && !string.IsNullOrEmpty(desc.ExampleJson)) { if (desc.ExampleJson.StartsWith("\"") && desc.ExampleJson.EndsWith("\"")) { desc.JsonParam = desc.ExampleJson.Trim('"'); } else if (desc.ExampleJson.StartsWith("!")) { desc.JsonParam = Newtonsoft.Json.JsonConvert.DeserializeObject(desc.ExampleJson.Substring(1)); } else { desc.JsonParam = Newtonsoft.Json.JsonConvert.DeserializeObject(desc.ExampleJson, type); } } return(desc); }
public static TypeDescription ToHumanName(string typeName) { return(_descriptor == null?new TypeDescription(typeName, ""):_descriptor.Get(typeName)); }