graphql-java-annotations icon indicating copy to clipboard operation
graphql-java-annotations copied to clipboard

GraphQLType Annotation is not interpreted in context of Method-Parameters

Open KlingPa opened this issue 6 months ago • 1 comments

In the example code below the parameter version is build into schema as Int! instead of NonNegativeInt!

public class Query {

	@GraphQLField
	@GraphQLDataFetcher(DocumentDataFetcher.class)
	public Document documentByNumber(
			@GraphQLNonNull @GraphQLName("number") String number,
			@GraphQLNonNull @GraphQLType(NonNegativeIntTypeFunction.class) @GraphQLName("version") Integer version) {
		return null;
	}
}

resulting in a schema of

documentByNumber(number: String!, version: Int!): Document

The reasons for this behaviour I found are:

  1. ArgumentBuilder does not consider GraphQLType at all, when building the parameter
  2. GraphQLType does not have the ElementType.PARAMETER in its Target annotation, so it is not possible to get this annotation with reflection at runtime like parameter.getAnnotation(GraphQLType.class)

Not sure if this is intentional behaviour.

KlingPa avatar May 22 '25 12:05 KlingPa

Hello @KlingPa,

Thank you very much for your analysis.

We have never encountered such issues in our projects and our ability to analyze community issues in the graphql-java-annotations project is currently limited; we therefore likely won't be able to address this issue anytime soon.

As you may have already investigated the cause and the problem's impacted code, we would be happy to consider your suggestions on this matter. You can submit a pull request with fixing code to solve the issue and/or tests reproducing the bug. We always strive to review and merge pull requests as quickly as possible.

Thank you for your understanding!

Best regards

jayblanc avatar Jun 05 '25 09:06 jayblanc

Hi @KlingPa ,

We're closing this ticket as inactive.

Feel free to re-open the issue once you have a reproduction scenario, or even better, a PR with the corresponding fix. We'll be happy to review it then.

Thanks,

Fgerthoffert avatar Oct 02 '25 09:10 Fgerthoffert