Mutation with Dictionary<string, object> as input using HotChocolate #6115
Unanswered
AndreiToader1
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everybody,
I have a question related to HotChocolate .NET library.
Is there a way I can have an input for a mutation a Dictionary<string, object> containing only the changed properties from the client?
For example assuming I have an entity Person with fields (Id, Name, EmailAddress) and at some point on the update mutation only name is changed. What I want to achieve is to be able to send from the UI only the name so the input will look like:
{
"personInputInput":
{
"name": "test123"
}
}
and I can deserialize something like this:
var input = context.ArgumentValue<Dictionary<string, object>>("person");
and the result would be a dictionary with one item having the key ""name" and the value "test123".
I'm looking for something else other than declaring all the fields as Optional<> with default values. For our current solution is too much to refactor this way.
Thank you in advance for your help,
Andrei
Beta Was this translation helpful? Give feedback.
All reactions