【发布时间】:2019-03-01 21:27:44
【问题描述】:
在 AWS AppSync 中,主查询上发送的参数似乎不会转发给所有子解析器。
type Query {
article(id: String!, consistentRead: Boolean): Article
book(id: String!, consistentRead: Boolean): Book
}
type Article {
title: String!
id: String!
}
type Book {
articleIds: [String]!
articles: [Article]!
id: String!
}
当我打电话时:
query GetBook {
book(id: 123, consistentRead: true) {
articles {
title
}
}
}
获取书的第一个查询接收$context.arguments 中的consistentRead 参数,但随后检索文章的查询没有。 ($context.arguments 为空)
我也在book 中尝试了articles(consistentRead: Boolean): [Article]!,但没有运气。
有谁知道在 AppSync 中是否可以将参数传递给同一请求的所有查询部分?
【问题讨论】:
-
这种使用请求标头的解决方法可以在有或没有管道的情况下使用 stackoverflow.com/a/58093410/1480391 它很丑,但它是我所知道的唯一允许将信息传递给所有子解析器的解决方案
标签: graphql aws-appsync appsync-apollo-client