//plain type -> type //array -> type[] //ref -> resolved type name //time formatted as int -> datetimeoffset //custom boolean -> plain boolean public static string TypeName(this DefinitionBase property) { string name; //basic resolution: arrays, references, basic types if (property.Type == TypeKind.array) { name = property.Items.TypeName() + "[]"; } else if (property.IsRef()) { name = property.Ref.Split('/').Last(); } else { name = property.Type; } //type post-processing { //merge bools if (name == "base_bool_int") { name = TypeKind.boolean; } //unix dates formatted as integers -> actual timestamps if (property.Description!= null && TimeDescriptionPattern.IsMatch(property.Description) && name == TypeKind.integer) { name = TypeKind.DateTimeOffset; } } return name; }