Spring-Boot GraphQL QueryResolver не вызывается
Когда я вызываю запрос в graphiQL, я получаю следующий ответ
{
"errors": [
{
"message": "The field at path '/customers' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value. The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is '[Customer!]' within parent type 'Query'",
"path": [
"customers"
],
"extensions": {
"classification": "NullValueInNonNullableField"
}
}
],
"data": null
}
Запрос:
query{
customers {
id
email
}
}
Проблема в том, что мой GraphQLQuery Resolver не вызывается. Я сделал точку останова, и приложение не сломалось.
GraphQLQueryResolver:
@RequiredArgsConstructor
@Component
public class Query implements GraphQLQueryResolver {
private final CustomerRepository customerRepository;
public Flux<Customer> customers() {
return customerRepository.findAll();
}
}
запрос.graphqls:
type Query{
customers: [Customer!]!
}
клиент.graphqls:
type Customer {
id: ID!,
email: String!
}
1 ответ
Это ожидается как
GraphQLQueryResolver
— тип из проекта graphql-java-kickstart . Spring для GraphQL вообще не имеет отношения к этому проекту.