aws-appsync-community
aws-appsync-community copied to clipboard
Allow VTL templates to define and use macros
I unsuccessfully tried to make use of the VTL standard macro functionality. Below is an example of what I would like to do
#macro( escape $string )
$string.replaceAll("'", "''").replaceAll...
#end
#set($safeName = "#escape($name)")
I have read on the AWS forums that most standard tools and macros are blocked. Is there a particular reason for this? Can macros be allowed?
I also have this issue. I would like to use a math.random() function into my mock response for API Gateway and am unable to do so.
Thank you for the feedback! This is a feature request, we have heard this request in the past and I will +1 it internally on your behalf. As with all feature requests, I cannot comment on the eventual availability.
Any news about this request? Or availability is still unknown? This could significantly shorten some resolvers and that's an important thing as there is a mapping templates size limit.
Are there any updates to this request? This would be of great use to us as well!
2 years since this request. Any updates please?
2 years since this request. Any updates please?
Still nothing but meanwhile I saw this nice trick from MappingTool
Yes, I saw this too, but our use case is some more complicated than this example. Macro would be a perfect fit.
Hello, we currently do not support macros. We have released support for JavaScript resolvers which makes it easier to write your business logic. https://docs.aws.amazon.com/appsync/latest/devguide/resolver-reference-js-version.html