-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Is your feature request related to a problem? Please describe.
Current query arg syntax is unwiedly, and involves the use of an extension method to convert a C# type into a graph type. Yes, it should be up to the user to supply the correct graph-type, but there should be an easier way so user does not have to think too much of the type or conversions before passing it in.
Describe the solution you'd like
Something simple, and easy for the user without giving up their control of the type being passed, but without conversion, such as:
services.AddGraphQL()
.Query<Author>(
() => new Query()
{
Expression = "author",
Args = new ArgList() {
["authorId"] = (long authorId) => {
DefaultValue = 0,
Description = "The Author to be searched"
},
["bookId"] = (long bookId) => {
DefaultValue = 0,
Description = "The Book to be searched"
},
["bookName"] = (string bookName) => {
DefaultValue = null,
Description = "The name of the Book to be searched"
},
},
Resolver = (context) => authorRepo.GetAll().Where(a => a.AuthorId == (long)context.Arguments["authorId"])
})
.Build()Describe alternatives you've considered
Improving the conversion syntax may also be helpful, but the real solution I feel is change how the arguments are added, in GraphQL.NET is equally painful
Metadata
Metadata
Assignees
Labels
No labels