-
Notifications
You must be signed in to change notification settings - Fork 317
Support custom argument resolvers for @SchemaMapping methods #259
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
Comments
@marceloverdijk I'm wondering if the changes for #258 addressed the case here with Generally, both |
Hi @rstoyanchev #258 already helps a lot to be honest. Having support for custom argument resolvers - like in e.g. MVC - I could do even more. Besides binding the arguments to an object I could also apply some login when binding, like defining default values as can be seen in the example below. The idea below is build upon Spring Data's
|
Thanks for clarifying. For the Of course it makes perfect sense to have such resolvers but for now it doesn't seem to be holding anything up, and with the two different types of handler methods and resolver contracts, I'd rather give this more time, before we find the best way to proceed. |
I understand. For me it's about having more control to which default value to set in the argument resolver; it's coming from #250 |
I'm having a similar issue, but I'm not sure if a custom argument resolver can help: Schema: scalar ConnectionCursor
type Query {
books(after: ConnectionCursor): [Book]
authors(after: ConnectionCursor): [Author]
} Controller: @Controller
public class MyController{
@QueryMapping
Flux<Book> books(@Argument BookConnectionCursor after) {
return Flux.empty();
}
@QueryMapping
Flux<Author> authors(@Argument AuthorConnectionCursor after) {
return Flux.empty();
}
} As you can see, in the schema there's only a generic When creating custom Can a custom argument resolver solve this issue? (I guess there I should have the class type of the controller method argument) EDIT: I just figured out that I can register @Bean
RuntimeWiringConfigurer configurer() {
return builder -> builder
.scalar(GraphQLScalarType.newScalar(Scalars.GraphQLString).name("ConnectionCursor").build());
} Works as intended 😸 First the registered scalar creates a |
I'm closing this as superseded by #325. |
As discussed in #250 this is feature request for support of custom argument resolvers in GraphQL controllers.
E.g. to support
The plain example as above could already be implemented using a
@ProjectedPayload
(Note: using the
@Argument
annotation for above case does not work me, see #258)But supporting custom argument resolvers could offer more flexibility I was looking for like the ability to use a custom
@interface
to provide defaults , e.g.The text was updated successfully, but these errors were encountered: