diff --git a/src/YouTrackSharp/Issues/Field.cs b/src/YouTrackSharp/Issues/Field.cs index b2c4de87..1215cbe2 100644 --- a/src/YouTrackSharp/Issues/Field.cs +++ b/src/YouTrackSharp/Issues/Field.cs @@ -50,6 +50,8 @@ public string AsString() return null; case ICollection collection: return collection.SingleOrDefault(); + case ICollection collection: + return collection.SingleOrDefault().FullName; } return Value.ToString(); diff --git a/src/YouTrackSharp/Issues/Issue.cs b/src/YouTrackSharp/Issues/Issue.cs index 8ca4008e..6f3bb29b 100644 --- a/src/YouTrackSharp/Issues/Issue.cs +++ b/src/YouTrackSharp/Issues/Issue.cs @@ -90,6 +90,11 @@ public bool IsMarkdown { /// public ICollection Fields => _fields.Values; + /// + /// Get all field names + /// + public ICollection FieldNames => _fields.Keys; + /// /// Issue comments. /// @@ -158,7 +163,10 @@ public override bool TrySetMember(SetMemberBinder binder, object value) if (fieldElement.Value is JArray fieldElementAsArray) { // Map collection - if (string.Equals(fieldElement.Name, "assignee", StringComparison.OrdinalIgnoreCase)) + // Heuristics for finding fields of the type List + var children = new List(fieldElementAsArray.First.Children()); + if (children.Count == 2 && children[0] is JProperty && ((JProperty)children[0]).Name == "value" + && children[1] is JProperty && ((JProperty)children[1]).Name == "fullName") { // For assignees, we can do a strong-typed list. fieldElement.Value = fieldElementAsArray.ToObject>();