[英]Apollo Java GraphQL Client: generateApolloSources failing
I am exploring graphql and I followed this tutorial https://www.graphql-java.com/tutorials/getting-started-with-spring-boot/ to get a server running.我正在探索 graphql 并按照本教程https://www.graphql-java.com/tutorials/getting-started-with-spring-boot/运行服务器。 I am now trying to write a Java client for this server using this library: https://github.com/apollographql/apollo-android .
我现在正在尝试使用此库为此服务器编写 Java 客户端: https://github.com/apollographql/apollo-android 。 My code so far is: https://github.com/alampada/graphql-java-client-tutorial , the readme includes steps to reproduce.
到目前为止,我的代码是: https://github.com/alampada/graphql-java-client-tutorial ,自述文件包括重现步骤。
I am not able to have the apollo client library to generate model for my query: https://github.com/alampada/graphql-java-client-tutorial/blob/master/src/main/graphql/com/example/book.graphql , as ./gradlew generateApolloSources
fails with:我无法让阿波罗客户端库为我的查询生成 model: 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
----------------------------------------------------
Could someone explain what I am doing wrong?有人可以解释我做错了什么吗?
Replying for reference as I managed to get this to work.当我设法使它起作用时,回复以供参考。 The graphql file should reference the name of the query from the schema rather than
book
. graphql 文件应该从模式而不是
book
中引用查询的名称。 Working example updated: https://github.com/alampada/graphql-java-client-tutorial/commit/30e7c0955a59dff4675b7f12c26873fe3dd37201#diff-76111f834f0748466f63240b018a755a更新的工作示例: https://github.com/alampada/graphql-java-client-tutorial/commit/30e7c0955a59dff4675b7f12c26873fe3dd37201#diff-76111f834f0748466f63240b018a
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.