-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for initializing classes/records via constructor #222
Comments
If you could split the |
Small thing in your example. schema.AddType<SortArgument>("sortArgument", null).AddAllFields(); You are using schema.AddInputType<SortArgument>("sortArgument", null).AddAllFields(); |
required
modifier
Sounds good; I've split the request for supporting the |
Thanks! 🙂 Interestingly, I wonder if it'd help discoverability to merge |
By the way, I can't find any difference between these snippets of code: // Works
schema.AddType<User>("users", null).AddAllFields();
schema.AddType<SortArgument>("sortArgument", null).AddAllFields(); and // Also works
schema.AddInputType<User>("users", null).AddAllFields();
schema.AddInputType<SortArgument>("sortArgument", null).AddAllFields(); |
You highlight something
Question is, I guess EnittyGraphQL should correctly raise an error if it see you do this? |
Honestly... I'm not sure 🙂 In theory, should it be allowed to use a type as both an input type and a normal type? For example: class Permission
{
public string Id { get; set; }
} Then we use
Probably not a case that would be worth supporting? 🙂 |
In an example like that it makes sense. The GraphQL spec does not support that. So other tools etc may complain. The spec states in simple terms
|
In that case, I think it'd be appropriate to throw an error if the type was added with |
I'm building my own sorting argument:
It'd be cool if
EntityGraphQL
supported initializingSortArgument
by calling its constructor, so that I could easily do additional validation and ensure thatPath
andDirection
are non-null:Just a suggestion 🙂 Thanks for the great library! ^_^
The text was updated successfully, but these errors were encountered: