-
Notifications
You must be signed in to change notification settings - Fork 322
Closed
Description
This simple example fails at the moment:
type Query {
pet: Pet
}
type Pet {
name: String
}
@QueryMapping
public String pet() {
return "123";
}
@SchemaMapping(typeName = "Pet", field = "name")
public String petName(String petId) {
return "Luna";
}
The reason seems to be that no HandlerMethodArgumentResolver
is applicable to String
.
Looking at the source resolver (SourceMethodArgumentResolver
)
@Override
public boolean supportsParameter(MethodParameter parameter) {
Class<?> type = parameter.getParameterType();
return (!BeanUtils.isSimpleValueType(type) && !type.isArray() && !Collection.class.isAssignableFrom(type));
}
simple types and arrays and collections are excluded.
I am wondering why.
This example is not so uncommon: I can return just an id like "123", which is then used to lookup more in the child DataFetchers.
Can we relax that to always fall back to SourceMethodArgumentResolver
regardless of type?
Metadata
Metadata
Assignees
Labels
type: enhancementA general enhancementA general enhancement