0

您想在使用 Apollo android(实际上是 Java Graphql Client)作为 Spring Boot 框架运行的 Web 服务项目中利用 github graphql api。遵循官方指南时出现错误。这是你的指南。 https://www.apollographql.com/docs/android/tutorial/02-add-the-graphql-schema/

在几个堆栈 ovwe 流程或熟人的建议下,修改了下载您的服务器架构部分中的说明并输入到终端中。gradlew 下载ApolloSchema -P com.apollographql.apollo.endpoint=http://api.github.com/graphql/ -P com.apollographql.apollo.schema=src/main/resources/graphql/schema.json

但是,由于 authtoken 未写入 github graphql api 的授权标头中,因此发生错误。

以下是错误的全文。

C:\Users\kk\IdeaProjects\gitpolio-server>gradlew downloadApolloSchema -P com.apollographql.apollo.endpoint=http://api.github.com/graphql/ -P com.apollographql.apollo.schema=src/main/r
esources/graphql/schema.json

> Task :downloadApolloSchema FAILED
Using the com.apollographql.apollo.endpoint property is deprecated. Use --endpoint instead.
Using the com.apollographql.apollo.schema property is deprecated. Use --schema instead.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':downloadApolloSchema'.
> cannot get schema from http://api.github.com/graphql/: 401:
  {"message":"This endpoint requires you to be authenticated.","documentation_url":"https://docs.github.com/graphql/guides/forming-calls-with-graphql#authenticating-with-graphql"}
  {"message":"This endpoint requires you to be authenticated.","documentation_url":"https://docs.github.com/graphql/guides/forming-cal
ls-with-graphql#authenticating-with-graphql"}
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
1 actionable task: 1 executed

我使用的是 7.2 版,Apollo 2.5.9。

另外,由于手动创建了json文件,在Rebuild过程中没有创建原始文件,无论json文件没有被识别。

4

0 回答 0