如何向 aws appsync api 提供 graphql 模式的 blob?

How to provide blob of graphql schema to aws appsync api?

我正在尝试使用 aws appsync api (StartSchemaCreation) 使用现有 graphql api 的模式创建新 graphql api 的模式,我用 GetIntrospectionSchema 转储了api 的 aws appsync。但是 StartSchemaCreation 的 --definition 参数要求我提供一团 graphql 模式以在新 api 中创建。我在 .json 和 .graphql 文件中有我的 graphql 模式,但我不能直接使用它们,因为它给出错误 "Failed to parse schema document - ensure it's a valid SDL-formatted document."

我需要帮助了解如何通过 start-schema-creation 的 --definition 参数传递我的 graphql 模式。

我正在使用 aws-cli StartSchemaCreation。

您可以使用

aws appsync start-schema-creation \
--api-id <your-api-id> \
--definition file://<file-path>