Skip to content

feat(appsync): add support for subscriptions for code-first schema generation - #10078

Merged
mergify[bot] merged 27 commits into
aws:masterfrom
BryanPan342:subscription
Sep 11, 2020
Merged

mergify[bot] merged 27 commits into
aws:masterfrom
BryanPan342:subscription

Conversation

@BryanPan342

@BryanPan342 BryanPan342 commented Aug 31, 2020 •

Copy link
Copy Markdown
Contributor

Implemented an addSubscription function for the appsync.Schema class to make easy schema generation.

api.addSubscription('addedFilm', new appsync.Field({
  returnType: film.attribute(),
  args: { id: appsync.GraphqlType.id({ isRequired: true }) },
  directive: [appsync.Directive.subscribe('addFilm')],
}));

Fixes: #9345


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@mergify

mergify Bot commented Aug 31, 2020

Copy link
Copy Markdown
Contributor

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@mergify mergify Bot added the contribution/core This is a PR that came from AWS. label Aug 31, 2020
@BryanPan342
BryanPan342 marked this pull request as draft August 31, 2020 18:11
@BryanPan342
BryanPan342 marked this pull request as ready for review September 4, 2020 22:46
Comment thread packages/@aws-cdk/aws-appsync/README.md Resolved
is the only exposed type that users can access to invoke a response to a mutation. This means
you can make any data source real time by specificy a GraphQL Schema directive on a mutation.

**Note**: The AWS AppSync client SDK automatically handles subscription connection management.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this something users need to consider when using subscriptions? it's not something they can affect in through their CDK app right?

@BryanPan342 BryanPan342 Sep 9, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think its nice to have something here because subscriptions are unique to AppSync. Thus for a new person scanning over the README, it would be nice to get a gloss of how that would work.

Comment thread packages/@aws-cdk/aws-appsync/README.md Resolved
Comment on lines +106 to +110
api.addSubscription('addedPlanets', new appsync.ResolvableField({
returnType: planet.attribute(),
args: { id: ScalarType.required_id },
directives: [appsync.Directive.subscribe('addPlanet')],
}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any additional changes to the verification steps because of this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless we want to build out an entire app to check if subscriptions work then no..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivlaks shivlaks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

@mergify

mergify Bot commented Sep 11, 2020

Copy link
Copy Markdown
Contributor

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation

Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: f5bced6
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify

mergify Bot commented Sep 11, 2020

Copy link
Copy Markdown
Contributor

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
mergify Bot merged commit 65db131 into aws:master Sep 11, 2020
mergify Bot pushed a commit that referenced this pull request Aug 18, 2021
Error in the documentation and type checking. Fixed both the readme and the related PR (integ test used a `Field` type so it still works as intended).

Related PR: #10078

Fixes: #16071

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
smguggen pushed a commit to smguggen/aws-cdk that referenced this pull request Aug 24, 2021
Error in the documentation and type checking. Fixed both the readme and the related PR (integ test used a `Field` type so it still works as intended).

Related PR: aws#10078

Fixes: aws#16071

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
Error in the documentation and type checking. Fixed both the readme and the related PR (integ test used a `Field` type so it still works as intended).

Related PR: aws#10078

Fixes: aws#16071

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Sep 6, 2021
Error in the documentation and type checking. Fixed both the readme and the related PR (integ test used a `Field` type so it still works as intended).

Related PR: aws#10078

Fixes: aws#16071

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
david-doyle-as24 pushed a commit to david-doyle-as24/aws-cdk that referenced this pull request Sep 7, 2021
Error in the documentation and type checking. Fixed both the readme and the related PR (integ test used a `Field` type so it still works as intended).

Related PR: aws#10078

Fixes: aws#16071

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
ali-n4i pushed a commit to ali-n4i/aws-cdk that referenced this pull request Jul 29, 2026
…neration (aws#10078)

Implemented an `addSubscription` function for the `appsync.Schema` class to make easy schema generation. 

```ts
api.addSubscription('addedFilm', new appsync.ResolvableField({
  returnType: film.attribute(),
  args: { id: appsync.GraphqlType.id({ isRequired: true }) },
  directive: [appsync.Directive.subscribe('addFilm')],
}));
```
Fixes: aws#9345 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
ali-n4i pushed a commit to ali-n4i/aws-cdk that referenced this pull request Jul 29, 2026
Error in the documentation and type checking. Fixed both the readme and the related PR (integ test used a `Field` type so it still works as intended).

Related PR: aws#10078

Fixes: aws#16071

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@aws-cdk/aws-appsync Related to AWS AppSync contribution/core This is a PR that came from AWS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aws-appsync] code-first implementation for subscription definition

3 participants