【问题标题】:amplify codegen models does not work properly on Android放大代码生成模型在 Android 上无法正常工作
【发布时间】:2021-02-27 13:04:18
【问题描述】:

我的期望:在输入 amplify codegen models 后,它应该为我已经存在的后端生成模型“类”。

会发生什么:消息输出:

No AppSync API configured. Please add an API.

到目前为止我做了什么:

  1. 提到的 Amplify 先决条件已经完成here
  2. 我通过amplify codegen 将我现有的 API 添加到我的 Android 项目中 这导致为突变/查询/订阅和 schema.json 生成文件,如下面的屏幕截图所示。
  3. 我想生成提到的模型类here

但是如上所述,模型类不会生成。可能有人对我的情况有解决方案。对我有很大帮助:)

【问题讨论】:

    标签: amazon-web-services graphql aws-amplify


    【解决方案1】:

    amplify codegen models 使用 CLI codegen 生成模型以用于新的 Amplify API 和 Amplify DataStore 类别,这与 AppSync 客户端使用的生成代码是分开的。

    要为 Amplify API 生成模型,请尝试使用以下命令:amplify add api 添加新 API。当提示您编辑模型时,请按照说明编辑指定路径中的 schema.graphql 文件。

    此时如果你尝试amplify codegen models,那么你会发现模型已经生成了。

    【讨论】:

    • 已添加 API。但不能在那里使用amplify codegen models
    猜你喜欢
    • 1970-01-01
    • 2017-04-13
    • 2020-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-12
    • 2017-02-28
    相关资源
    最近更新 更多