Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 27 commits into from
Sep 11, 2020

Conversation

BryanPan342
Copy link
Contributor

@BryanPan342 BryanPan342 commented Aug 31, 2020

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
Copy link
Contributor

mergify bot commented Aug 31, 2020

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
packages/@aws-cdk/aws-appsync/README.md Show resolved Hide 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
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?

Copy link
Contributor Author

@BryanPan342 BryanPan342 Sep 9, 2020

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.

packages/@aws-cdk/aws-appsync/README.md Outdated Show resolved Hide 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
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
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
Contributor Author

Choose a reason for hiding this comment

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

packages/@aws-cdk/aws-appsync/lib/schema.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@shivlaks shivlaks left a comment

Choose a reason for hiding this comment

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

nice work!

@mergify
Copy link
Contributor

mergify bot commented Sep 11, 2020

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
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
Copy link
Contributor

mergify bot commented Sep 11, 2020

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*
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