Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/GraphQL.Relay/Types/MutationInputs.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using GraphQL.Execution;

namespace GraphQL.Relay.Types
{
public class MutationInputs : Dictionary<string, object>
Expand All @@ -15,9 +17,11 @@ public object Get(string key)
return this[key];
}

public T Get<T>(string key, T defaultValue = default)
public T Get<T>(string key, T defaultValue = default) where T : class
{
return TryGetValue(key, out object value) ? (T)value : defaultValue;
if (!TryGetValue(key, out object value))
return defaultValue;
return value is Dictionary<string, object> dictionary ? dictionary.ToObject<T>() : (T)value;
}
}
}