graphiQL 未显示 GraphQL schmeaspring graphql-spqr

问题描述

我正在使用带有 graphql-spqr 的 spring-boot。 GraphQL 查询和变更有效。但是 GraphiQL webfrontend 没有在最右边一列的“documentatin explorer”中显示模式。为什么?

我的 graphql 控制器

@RestController
public class LiquidoGraphQLController {
    private final GraphQL graphQL;

    @Autowired
    public LiquidoGraphQLController(
        TeamsGraphQL teamsGraphQL,// my graphQL service classes
        PollsGraphQL pollsGraphQL,UsergraphQL usergraphQL
    ) {
        // Automatically create GraphQL Schema from graphql-spqr annotations
        GraphQLSchema schema = new GraphQLSchemaGenerator()
            .withBasePackages("org.doogie.liquido")
            .withOperationsFromSingleton(teamsGraphQL,TeamsGraphQL.class)
            .withOperationsFromSingleton(pollsGraphQL,PollsGraphQL.class)
            .withOperationsFromSingleton(usergraphQL,UsergraphQL.class)
            .withOutputConverters()
            .generate();

        this.graphQL = new GraphQL.Builder(schema).build();
    }
}

GraphiQL 显示“schmea”,但在文档选项卡中不显示任何内容

enter image description here

解决方法

谢谢你的提示。经过一些调试后我发现,在我的自定义 GraphQL 控制器中,我直接返回了 graphQL 数据,而不是带有数据的 ExecutionResult:{},错误:[]