【问题标题】:How to provide blob of graphql schema to aws appsync api?如何向 aws appsync api 提供 graphql 模式的 blob?
【发布时间】:2018-08-23 00:20:00
【问题描述】:

我正在尝试使用 aws appsync api (StartSchemaCreation) 创建具有现有 graphql api 架构的新 graphql api 架构,我使用 aws appsync 的 GetIntrospectionSchema api 转储了该架构。但是 StartSchemaCreation 的 --definition 参数要求我提供一个 graphql 模式的 blob 以在新的 api 中创建。我在 .json 和 .graphql 文件中有我的 graphql 架构,但我不能直接使用它们,因为它会给出错误“无法解析架构文档 - 确保它是有效的 SDL 格式的文档。”

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

我正在使用 aws-cli StartSchemaCreation。

【问题讨论】:

    标签: aws-cli aws-appsync


    【解决方案1】:

    你可以使用

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

    【讨论】:

    • 这对我也有用。具有讽刺意味的是,它与亚马逊自己的文档完全冲突:“路径不应包含任何协议标识符,例如 http:// 或 file://。docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html
    • 我使用 'cat' 命令来传递文件内容:--definition "$(cat myfile.graphql)"。但是 myfile 变得太大,bash 开始给出错误“参数列表太长”。使用 file://myfile.graphql 解决了我的问题。谢谢!
    猜你喜欢
    • 2020-11-12
    • 2022-01-23
    • 2020-09-10
    • 2020-08-20
    • 2018-08-25
    • 2023-03-30
    • 2018-10-11
    • 2022-12-08
    • 2019-07-18
    相关资源
    最近更新 更多