gpt4 book ai didi

amazon-web-services - 联合类型导致 graphql 订阅

转载 作者:行者123 更新时间:2023-12-02 17:00:03 24 4
gpt4 key购买 nike

是否可以在 graphql 订阅上获得联合结果,特别是在 AppSync 中?

我在 AppSync 中尝试了以下操作,但收到错误消息“订阅的输出类型无效”

type Mutation {
test1Mutation(test1arg: Test1Input!): Test1,
test2Mutation(test2arg: Test2Input!): Test2
}

union DataMutationResult = Test1 | Test2

type Subscription {
dataMutation(id: ID!): DataMutationResult
@aws_subscribe(mutations: ["test1Mutation", "test2Mutation"])
}

最佳答案

AppSync 要求一个订阅中的突变返回类型全部相同。我最终为所有突变制作了一个包装器返回类型,并在该包装器中有一个联合。

关于amazon-web-services - 联合类型导致 graphql 订阅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54553719/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com