0

I am using spring-boot with graphql-spqr. GraphQL queries and mutations work. But the GraphiQL webfrontend does not show the schema in the "documentatin explorer" in the rightmost column. Why?

My graphql Controller

@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 shows the "schmea", but doesn't show anything in the documentation tab.
enter image description here

Robert
  • 1,579
  • 1
  • 21
  • 36
  • Do you have any kind of auth setup? One possibility is that the introspection query(one which fetches the schema) might be failing due to which it's not showing up here. Check out the dev tools of your browser to see the network call being made for the introspection query. – Madhu Bhat May 03 '21 at 06:09
  • Exactly as @MadhuBhat said. Check both the browser tools and the server log for errors, and see what result did you get for introspection. It failed for some reason. Also, if you using Spring Boot, you don't need to any of the stuff you did, no custom controller, no call to the schema generator etc. All already done for you. And `withOutputConverters` call is redundant. – kaqqao May 03 '21 at 09:16

1 Answers1

0

Thank you for the tips. After some debuggin I found out, that in my Custom GraphQL Controller I directly returned the graphQL data, instead of the ExecutionResult with data: {}, errors: []

Robert
  • 1,579
  • 1
  • 21
  • 36