- OpenLiberty(25.0.0.12 -> https://openliberty.io/start/#gradle) с функцией mpGraphQL-2.0
- MicroProfile GraphQL API 2.0
- Java 21
Код: Выделить всё
[WARNUNG ] SRGQL010002: Operation [subName] also exist as a batch operation - ignoring the non-batch operationКод: Выделить всё
query Test {
testDto {
name
subName
}
}
Код: Выделить всё
{
"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
}
}
}
Код: Выделить всё
@GraphQLApi
public class TestGQL {
@Query
public TestDto getTestDto() {
return new TestDto("P1");
}
@Query
public List getTestDtos() {
List 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 getSubNameBatch(@Source List testDtos) {
return testDtos.stream().map(p -> p.name + "_BatchResolver").toList();
}
public static class TestDto {
public String name;
public TestDto(String name) {
this.name = name;
}
}
}
Код: Выделить всё
jakartaee-10.0
microProfile-7.0
mpGraphQL-2.0
Код: Выделить всё
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'
}
Что-то неправильно настроено в моей настройке или это ошибка в реализации OpenLiberty MicroProfile GraphQL?
Подробнее здесь: https://stackoverflow.com/questions/798 ... hql-implem
Мобильная версия