EvaluateMappingTemplate
Source:
src/AWS/AppSync/EvaluateMappingTemplate.ts
Runtime binding for appsync:EvaluateMappingTemplate — evaluate a VTL
request/response mapping template against a mock context without touching
a deployed resolver. The VTL twin of EvaluateCode, for resolvers
defined with requestMappingTemplate/responseMappingTemplate instead of
APPSYNC_JS code.
An account-level operation: the binding takes no resource. Template
evaluation errors do not fail the effect — they surface on the
response’s error field. Provide AppSync.EvaluateMappingTemplateHttp
on the hosting function’s Effect to implement the binding.
Evaluating Mapping Templates
Section titled “Evaluating Mapping Templates”// init — account-level binding takes no resourceconst evaluateTemplate = yield* AppSync.EvaluateMappingTemplate();
// runtimeconst result = yield* evaluateTemplate({ template: `{ "sum": $util.toJson($ctx.args.a + $ctx.args.b) }`, context: JSON.stringify({ arguments: { a: 2, b: 3 } }),});// JSON.parse(result.evaluationResult!) → { sum: 5 }