aws / aws-appsync-community

The AWS AppSync community
https://aws.amazon.com/appsync
Apache License 2.0
507 stars 32 forks source link

Is executing subscriptions with multiple response types possible? #250

Closed pdeva03 closed 10 months ago

pdeva03 commented 2 years ago

type Post @model { id: ID! title: String! content: String comments: [Comment] @hasMany }

type Comment @model { id: ID! content: String postCommentsId: ID! }

type Subscription { onCommentPosts(postCommentsId: ID!): Object @aws_subscribe(mutations: ["createComment", "createPost"]) }

In the mutations array, is it possible to have different response type? If so, how we can declare that?

onlybakam commented 10 months ago

Hello, it is not possible to provide different response type if the mutations array. You can use the selection set in your subscription to specify the data you want to get back. In your mutation, make sure to provide a selection set that is at least a super set of the data you want your subscriptions to receive.