Currently, I'm utilizing typescript in conjunction with AWS CDK to produce a cloudFormation template for an api gateway. The process involves using an Apache Velocity template to assist in converting my response data. However, as I go about creating the API gateway using typescript, I find myself facing a challenge - how do I pass the template directly from the code itself? Specifically, I have a requirement to pass my template within the responseTemplates property of the IntegrationOptions interface, which expects a string input. Unfortunately, thus far, I haven't been able to locate a straightforward method to convert the template into a string format.
{
"sellableQuantity": $inputRoot.quantity),
"reservedQuantity": $inputRoot.reservedQuantity)
"marketplaceInventories": [
#foreach( $marketplaceInventory in $inputRoot.marketplaceInventories) )
{
"sellableQuantity": $marketplaceInventory.sellableQuantity,
"marketplaceAttributes": {
#set( $marketplaceAttributes = $marketplaceInventory.marketplaceAttributes )
"marketplaceName": "$marketplaceAttributes.marketplaceName",
"channelName": "$marketplaceAttributes.channelName"
}
}
#if( $foreach.hasNext ) , #end
#end
]
}