-
Notifications
You must be signed in to change notification settings - Fork 311
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
Allow for more customization in GraphQlArgumentBinder #833
Comments
Thanks for raising this. From what I can see For the |
Hi @rstoyanchev I would like to start by saying that this issue is not meant to be "Here is problem that needs a fix", it's more of "here a suggestion, if you think it's worthwhile to implement, please consider it". I mentioned What I tried to convey is that
In the method signature, it's not very clear how the GraphQl field argument(s) is related to the method parameter, and the parameter name has no bearing to the argument name. In fact, you could rename it to
In the opposite side, the
It's very clear that the field contains and argument named It's hard to configure/extend Binding GraphQl argument happens in more than one context: 1) field arguments. 2) schema directives. 3) operation directives. All have the one thing in common, they only support input types So we may come up with an interface like this:
So facilitate extension,
This is a rough sketch. If you don't think it's worthwhile, feel free to close this. As it's I can do everything that I need.
There is more than one way to do it, and we will not agree on single solution, so it's best to leave it for users to implement. I myself will try to use sealed types and somehow do Side note: I wanted to open this as a "Discussion", but they are not enabled. |
Apologies I know this isn't entirely relevant to the initial issue, but I was wondering if the spring-graphql library does/will support the |
To customize controller argument binding you have to use
HandlerMethodArgumentResolver
which can bind any number GraphQl argument to single method parameter, the interface is quite flexible but requires more work. Also, no more@Argument
on the handler parameters, which makes things less obvious.As a motivation, GraphQL Java recently added support for
@oneof
directive for input types, to get the most out of it, you will need to customize the handling for arguments based on a directive(rolling out the usage ofConverter
).I really like the signature of the bind method on
GraphQlArgumentBinder
:(Can we get rid of the
@Nullable
? matching the Argument inGraphQlArgumentBinder
)One solution would be to introduce a new abstraction and do Spring's standard way of registering beans implementing said abstraction and the framework would auto wire them in the right place.
Another solution is to change
GraphQlArgumentBinder
and make it more friendly to user extension. e.g. make most methodsprotected
, add an extension point for implementers, and register it as a bean so users can replace it.The text was updated successfully, but these errors were encountered: