AWS 的 amplify codegen 自动生成的 API. Swift 文件属性不完整

2019-11-29 10:59:18 +08:00
 lipyoung

bug 描述 我使用了 AWS 的 AppSync 做后台开发。使用 amplify codegen 指令会自动生成 API.swift 文件,里面的属性能正常被 iOS 端使用,但是嵌套的属性无法访问。

重现步骤

  1. 自定义 schema 文件:
type Comment {
	id: ID!
	content: String
}
type Query {
	getTodos(limit: Int, nextToken: String): TodoConnection
	getTodo(id: ID, title: String): Todo
}
type Todo {
	id: ID!
	title: String
	comments: [Comment]
}
type TodoConnection {
	todos: [Todo]
	nextToken: String
}
schema {
	query: Query
}
  1. 使用 amplify codegen 指令
  2. 使用 API.swift iOS 端文件
  3. 无法读取嵌套属性内容

期望 我希望 iOS 端能使用嵌套的属性。 This is swift code:

1. let todoComment = GetTodoQuery.Data.GetTodo.Comment(id: "id", content: "content")
2. print(todoComment.content)
        
3. let todosComment = GetTodosQuery.Data.GetTodo.Todo.Comment
4. print(todosComment.content)

第 3 行和第 4 行就是错误的。没办法访问到嵌套的数组里面的内容。因为自动生成的API.swift里面没有。但是非嵌套就能访问到。真是服了

环境

补充内容 我来试一下名声在外的全球工单系统,我 2 天前给 AWS iOS SDK 的 github 仓库提交了 BUG,根本没有人理我 😭。现在不能访问数组里面的属性,我自己写的项目搞的很难受。求助懂 AWS amplify 和 iOS 端的大神出来救援一下

2140 次点击
所在节点    全球工单系统
1 条回复
lipyoung
2019-11-29 11:00:49 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/624219

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX