-
Notifications
You must be signed in to change notification settings - Fork 97
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
@GraphQLNonNull is ignored in combination with @GraphQLType #308
Comments
Thanks, we'll look into this and hope to have an answer within a month or so. Note that you can also submit a PR directly if you have identified where the issue is located. |
Hello, could you provide a more complete code sample to reproduce your problem ? You may also start a PR, even draft, if you have any test case that reproduce it. |
I fixed the problem for my concrete TypeFunction I found the private TypeFunction getTypeFunction(Method method, ProcessingElementsContainer container) {
graphql.annotations.annotationTypes.GraphQLType annotation = method.getAnnotation(graphql.annotations.annotationTypes.GraphQLType.class);
TypeFunction typeFunction = container.getDefaultTypeFunction();
if (annotation != null) {
typeFunction = newInstance(annotation.value());
}
return typeFunction;
} For my annotated method @Override
public GraphQLType buildType(boolean input, Class<?> aClass, AnnotatedType annotatedType, ProcessingElementsContainer container) {
TypeFunction typeFunction = getTypeFunction(aClass, annotatedType);
if (typeFunction == null) {
throw new IllegalArgumentException("unsupported type");
}
GraphQLType result = typeFunction.buildType(input, aClass, annotatedType, container);
if (annotatedType != null && annotatedType.isAnnotationPresent(GraphQLNonNull.class)) {
result = new graphql.schema.GraphQLNonNull(result);
}
return result;
} I copied this behaviour in my Now I'm not sure if this is the intended way to do for concrete implementations or should be concerned by maybe |
The following is a simplified version of my problem.
I have an input class
MyInput
likeThe created schema does not define
foo
as non-null:If I remove the
@GraphQLType
annotation the contained input looks like that:Note:
Foo
is the data type of a field in several classes (sayMyInputOne
,MyInputTwo
, ...) in my application. The GraphQL interface should use specific enums (BarOne
orBarTwo
...) as data types for each class.The text was updated successfully, but these errors were encountered: