-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(appsync): add caching config to AppSync resolvers #17815
fix(appsync): add caching config to AppSync resolvers #17815
Conversation
Awesome. Thanks for doing this! Looking forward to its release. |
export interface CachingConfig { | ||
/** | ||
* The caching keys for a resolver that has caching enabled. | ||
* Valid values are entries from the $context.arguments, $context.source, and $context.identity maps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also add validation for this constraint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright - added validation for caching keys + unit test - added some constants for $context.source, $context.arguments and $context.identity to help validate that caching keys are prefixed by these keys. Technically, there's some VTL syntax that should be adhered to but I think that may be a bit much for CDK to take on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! One last thing: Before validating you should check whether the value is encoded as a token, using the Token.isUnresolved()
static method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah cool - I'll make this change!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright sweet - done! Checked to see if the caching key is resolved first before validating.
|
||
/** | ||
* The TTL in seconds for a resolver that has caching enabled. | ||
* Valid values are between 1 and 3600 seconds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing with this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added validation + unit tests for ttl!
Pull request has been modified.
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). |
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
While trying to add caching config to some of my application's resolvers, I discovered that the BaseResolverProps do not include caching configuration like the CfnResolver does. This PR adds this missing caching configuration to the BaseResolverProps and adds the configuration as part of the creation of the CfnResolver. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
While trying to add caching config to some of my application's resolvers, I discovered that the BaseResolverProps do not include caching configuration like the CfnResolver does.
This PR adds this missing caching configuration to the BaseResolverProps and adds the configuration as part of the creation of the CfnResolver.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license