Within GraphQL-Dotnet i have a mutation with a list type input type, and within that type, i have a list of items, which themselves are an input type.
I have defined the mutation and the resolver for the mutation to be:
Field<ListType>("createList")
.Argument<NonNullGraphType<ListInputType>>("list")
.ResolveAsync(async context =>
{
var list = context.GetArgument<ListEntity>("list");
var val = await dataContext.AddAsync(list);
await dataContext.SaveChangesAsync();
return val.Entity;
});
And my list type is defined as
public class ListInputType : InputObjectGraphType<ListEntity>
{
public ListInputType()
{
Name = "listInput";
Field(f => f.Key).Description("list key");
///...
Field<ListGraphType<ListItemInputType>>("items").Resolve(f =>
{
return null;
});
}
}
I am expecting to be able to put a break point within the resolve, and examine what is going on within the resolve, so that i can finish mapping up the list items, so i am able to then have EF within the mutation definition, save both the new list its self, as well as the items.
The breakpoint never gets hit.
I have also tried Field(f => f.ListItems)
on its own instead of the Field<ListGraphType<ListItemInputType>>...
line, and that creates a schema for me, but i get hidden crashes and exceptions that cannot be caught when i attempt to push the mutation.
All i am looking to do is the following:
mutation {
createList(list: {
key: "new_list",
items: [
{
alias: "alias1",
order: 1
},
{
alias: "alias2",
order: 2
},
{
alias: "alias3",
order: 3
}
]
}) {
id
}
}
But i dont seem to be able to figure it out or find the answer anywhere on here or google.