fix(appsync): add caching config to AppSync resolvers#17815
fix(appsync): add caching config to AppSync resolvers#17815mergify[bot] merged 11 commits intoaws:masterfrom
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.
Can you please also add validation for this constraint?
There was a problem hiding this comment.
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.
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.
Ah cool - I'll make this change!
There was a problem hiding this comment.
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.
Same thing with this one.
There was a problem hiding this comment.
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