Questions tagged [vtl]

The Velocity Template Language (VTL) is meant to provide the easiest, simplest, and cleanest way to incorporate dynamic content in a web page.

VTL is the Velocity Template Language.

It includes Variables, Properties, Methods, Directives, Macros, and more...

Reference: http://velocity.apache.org/engine/2.0/vtl-reference.html

193 questions
2
votes
1 answer

Velocity in AWS Api Gateway: how to access array of objects

So in AWS Api Gateway, I'm querying my DynamoDB and gets this JSON as reply: https://pastebin.com/GpQady4Z So, Items is an array of 3 objects. I need to extract the properties of those objects: TS, Key and CamID. I'm using Velocity in the…
stKKd
  • 444
  • 1
  • 5
  • 11
2
votes
2 answers

Browse a directory in Velocity Template Language with Telosys

I am trying to write templates in VTL to generate java classes with telosys. My starting point is a directory (src/main/resources/templates/es) that contains json files (mapping1.json, mapping2.json, ...). The number and names of json files are…
Lazcool
  • 63
  • 8
2
votes
2 answers

adding Or updating Modified Date attribute in AppSync using VTL

I am working on AppSync,I am struggling on how to save date in Dynamo Db using VTL. My actual requirement is to save the date when the API is called. Please let me know how to achieve this using Date.now() in Dynamo Db. Thanks in advance.
RAHUL SRV
  • 262
  • 3
  • 24
2
votes
2 answers

How to resolve parent to child relationship with AppSync

I have schema looking like below type Post { id: ID! creator: String! createdAt: String! like: Int! dislike: Int! frozen: Boolean! revisions:[PostRevision!] } type PostRevision { id: ID! post: Post! content:…
forJ
  • 4,309
  • 6
  • 34
  • 60
2
votes
1 answer

Dot after Reference in Body Mapping Template (AWS API Gateway)

Is it possible to use a dot directly after a reference in API Gateway's Body Mapping Templates? I do string concatination like this: #set($region = "us-east-2") #set($apiid = "$context.apiId") #set($stage = "$context.stage") #set($path =…
2
votes
1 answer

Simple GetItem with ctx.identity.username returns null

I'm using AppSync with IAM auth with a DynamoDB resolver and Cognito. I'm trying to do the following. { "version": "2017-02-28", "operation": "GetItem", "key": { "userId": $util.dynamodb.toDynamoDBJson($ctx.identity.username) …
Tom
  • 785
  • 10
  • 26
2
votes
2 answers

Is it possible to add all stages variables into the body mapping template in a nested JSON structure?

I'm using the API gateway and have a service that passes on data to a Step Function. Steps functions require JSON input in the following format: { "input":"", "stateMachineArn":…
cyorkston
  • 225
  • 1
  • 10
2
votes
1 answer

Return null if key does not exist in VTL / API Gateway Template

The following template returns '' if the Authorization header is not present. How can i get null instead? So return null if key is not present... { "headers" : { "authorization" : "$input.params().header.get('Authorization')" } }
Rentrop
  • 20,979
  • 10
  • 72
  • 100
2
votes
3 answers

AWS Gateway API mapping using VTL times out

I have a AWS Gateway API that defines a simple GET. I use that to trigger a Lambda. Using the request mapping i take the query params and create a json object to give the Lambda. Here is my mapping #set ($myMap =…
Nexeh
  • 213
  • 3
  • 18
2
votes
1 answer

What is the lexically correct statement in Velocity Template Language

The following line of code is a generic version of a line in a template I'm working on. I have looked at the Velocity Template Language Documentation but I keep getting errors no matter how I format this statement. This is my first real experience…
Bobby
  • 18,217
  • 15
  • 74
  • 89
2
votes
2 answers

Reference a Map by name within Velocity Template

Pretty sure there is an easy answer to this, but just can't find the right VTL syntax. In my context I'm passing a Map which contains other Maps. I'd like to reference these inner maps by name and assign them within my template. The inner maps are…
Wiretap
  • 771
  • 2
  • 9
  • 13
2
votes
1 answer

Sorting an array of strings in VTL

Being mainly a VB.NET programmer, I am extremely new to VTL (Velocity Template Language). I am currently trying to customise an application that uses Velocity templates and Jython. I have the following VTL code in an existing file. This code obtains…
JimmyTheOne
  • 233
  • 2
  • 13
2
votes
1 answer

Using the output of one velocity template in another

I have a velocity template (in a Confluence user macro) that looks like: ## This macro takes a jiraissues macro in the body with "Show Total Only" configured to TRUE. ## It then parses the return and puts a green check if the number returned is ZERO…
Bruce P. Henry
  • 412
  • 1
  • 4
  • 14
1
vote
1 answer

Is velocity.log created for Apache Velocity v2.0 by default?

Since with Apache Velocity v2.0 we have moved to SLF4J, how to handle creation of velocity.log for serverless calls? For example if an AWS lambda function is calling the java code using VTL, during runtime velocity.log will not be able to create.…
sraipuria
  • 11
  • 2
1
vote
1 answer

Appsync VTL resolvers assigning null to a an object

I extended the default resolvers I received from Amplify/Appsync for one of my models. I saved my code as Mutation.updateMovement.preUpdate.1.req.vtl, and here's my VTL file: #set( $muscleGroups = $ctx.args.input.muscleGroups ) #if( $muscleGroups &&…
barshopen
  • 1,190
  • 2
  • 15
  • 28