Apollo Java GraphQL 客户端:generateApolloSources 失败
Apollo Java GraphQL Client: generateApolloSources failing
我正在探索 graphql,我遵循了本教程 https://www.graphql-java.com/tutorials/getting-started-with-spring-boot/ to get a server running. I am now trying to write a Java client for this server using this library: https://github.com/apollographql/apollo-android . My code so far is: https://github.com/alampada/graphql-java-client-tutorial,自述文件包括重现步骤。
我无法让 apollo 客户端库为我的查询生成模型:https://github.com/alampada/graphql-java-client-tutorial/blob/master/src/main/graphql/com/example/book.graphql,因为 ./gradlew generateApolloSources
失败:
Can't query `Book` on type `Query`
----------------------------------------------------
[1]:query BookQuery($id: ID!) {
[2]: Book (id: $id) {
[3]: id
----------------------------------------------------
谁能解释一下我做错了什么?
回复以供参考,因为我设法使它起作用。
graphql 文件应该从模式中引用查询的名称,而不是 book
。
工作示例已更新:https://github.com/alampada/graphql-java-client-tutorial/commit/30e7c0955a59dff4675b7f12c26873fe3dd37201#diff-76111f834f0748466f63240b018a755a
我正在探索 graphql,我遵循了本教程 https://www.graphql-java.com/tutorials/getting-started-with-spring-boot/ to get a server running. I am now trying to write a Java client for this server using this library: https://github.com/apollographql/apollo-android . My code so far is: https://github.com/alampada/graphql-java-client-tutorial,自述文件包括重现步骤。
我无法让 apollo 客户端库为我的查询生成模型:https://github.com/alampada/graphql-java-client-tutorial/blob/master/src/main/graphql/com/example/book.graphql,因为 ./gradlew generateApolloSources
失败:
Can't query `Book` on type `Query`
----------------------------------------------------
[1]:query BookQuery($id: ID!) {
[2]: Book (id: $id) {
[3]: id
----------------------------------------------------
谁能解释一下我做错了什么?
回复以供参考,因为我设法使它起作用。
graphql 文件应该从模式中引用查询的名称,而不是 book
。
工作示例已更新:https://github.com/alampada/graphql-java-client-tutorial/commit/30e7c0955a59dff4675b7f12c26873fe3dd37201#diff-76111f834f0748466f63240b018a755a