2

Environment:

I'm trying to use batch resolvers in MicroProfile GraphQL 2.0 with OpenLiberty, but the batch resolver doesn't seem to be invoked even though the server logs indicate it should be.

[WARNUNG ] SRGQL010002: Operation [subName] also exist as a batch operation - ignoring the non-batch operation

So both Resolver methods are recognized, but when calling the API it throws NPE when accessing the 'subName':

query Test {
 testDto {
 name
 subName
 }
}

Results in:

{
 "errors": [
 {
 "message": "Server Error",
 "locations": [
 {
 "line": 4,
 "column": 5
 }
 ],
 "path": [
 "testDto",
 "subName"
 ],
 "extensions": {
 "exception": "java.lang.NullPointerException",
 "classification": "DataFetchingException",
 "code": "null-pointer"
 }
 }
 ],
 "data": {
 "testDto": {
 "name": "P1",
 "subName": null
 }
 }
}

I have a simple GraphQL API with both a single resolver and a batch resolver for the same field:


@GraphQLApi
public class TestGQL {
 @Query
 public TestDto getTestDto() {
 return new TestDto("P1");
 }
 @Query
 public List<TestDto> getTestDtos() {
 List<TestDto> result = new ArrayList<>();
 result.add(new TestDto("P2"));
 result.add(new TestDto("P3"));
 return result;
 }
 @Name("subName")
 public String getSubName(@Source TestDto testDto) {
 return testDto.name + "_SingleResolver";
 }
 @Name("subName")
 public List<String> getSubNameBatch(@Source List<TestDto> testDtos) {
 return testDtos.stream().map(p -> p.name + "_BatchResolver").toList();
 }
 public static class TestDto {
 public String name;
 public TestDto(String name) {
 this.name = name;
 }
 }
}

Enabled features in my server.xml

 <featureManager>
 <feature>jakartaee-10.0</feature>
 <feature>microProfile-7.0</feature>
 <feature>mpGraphQL-2.0</feature>
 </featureManager>

Dependencies in my build.gradle:

dependencies {
 // provided dependencies
 providedCompile 'jakarta.platform:jakarta.jakartaee-api:10.0.0' 
 providedCompile 'org.eclipse.microprofile:microprofile:7.0'
 // https://mvnrepository.com/artifact/org.eclipse.microprofile.graphql/microprofile-graphql-api
 implementation 'org.eclipse.microprofile.graphql:microprofile-graphql-api:2.0'
}

Question:
Is there something misconfigured in my setup, or is this a bug in the OpenLiberty implementation of MicroProfile GraphQL?

asked Dec 13, 2025 at 0:29

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.