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
6
votes
1 answer

How to send custom error in AppSync with $util.error

I have a question about AppSync error handling. I would like to send errorInfo object along with the error response and I tried with $util.error. Per the…
Tan Duong
  • 1,473
  • 2
  • 17
  • 29
6
votes
2 answers

Return nested JSON in AWS AppSync query

I'm quite new to AppSync (and GraphQL), in general, but I'm running into a strange issue when hooking up resolvers to our DynamoDB tables. Specifically, we have a nested Map structure for one of our item's attributes that is arbitrarily constructed…
6
votes
1 answer

Apache Velocity macro default parameter values

I want to update a macro that's shared between a number of different .vtl files to include a new parameter. However, I only want to change the call in one of my .vtl files and leave the others unchanged. So, I essentially want to add an optional…
LoganBlack
  • 254
  • 2
  • 14
6
votes
1 answer

IntelliJ IDEA override $user

It's a quite simple question, but I can't find an answer to it using SO-Search and Google. Is it possible to override the default $user VTL-variable used in file-templates globally, instead of setting it in each template with #set($user = "...")…
Pr0gr4mm3r
  • 6,170
  • 1
  • 18
  • 23
5
votes
1 answer

Add or Update Property on JSON object with Mapping Template (AWS API Gateway)

In my AWS APIGW Rest API, I'm trying to add and/or update a property on the request body (JSON) that is submitted. Every example I could find deals with constructing a new JSON object, not updating the existing one. In the Integration Request…
Chris Smith
  • 592
  • 3
  • 9
5
votes
1 answer

DynamoDB ReturnValues UPDATED_OLD in AppSync

Im trying to update an item attribute in a DynamoDb table with AppSync. Once successful i want to use the previous value of that attribute as the key in my next call (I'm using pipeline resolvers). To achieve this with DynamoDB you just set…
5
votes
1 answer

Java Spark/Velocity Templates/SQL2o

I'm using the Spark Java Web Framework with Apache's Velocity Template Engine in order to help design a responsive web application that pulls data from a SQL database. Using SQL2o I've created some Java objects of custom class types, i.e. user,…
TheFunk
  • 981
  • 11
  • 39
4
votes
1 answer

AWS Amplify Custom Resolver - Unsupported operation 'BatchPutItem'

I'm following some guides to implement a custom resolver with BatchPutItem operation. Currently I'm facing some issues which I can't get right. The error output { "data": { "batchAddBusiness": null }, "errors": [ { "path": [ …
4
votes
2 answers

Create JSON Object with Velocity Template Language

I am working with the Apache Velocity Template Language (VTL) in AWS AppSync. In my request template I query an undefined amount of items with different elements. What I want to do in the response template is to transform the result into a JSON…
benra
  • 386
  • 1
  • 4
  • 18
4
votes
2 answers

Dollar and exclamation mark (bang) symbols in VTL

I've recently encountered these two variables in some Velocity code: $!variable1 !$variable2 I was surprised by the similarity of these so I became suspicious about the correctness of the code and become interested in finding the difference between…
Jr.
  • 115
  • 2
  • 10
4
votes
0 answers

Apache VTL - How to find an item in an array

I am trying to use VTL for the first time and cannot see to get arrays to grab an inputted String. I have tried "in" (but I do not believe this is a key word in this language), as well .contains() below (but it does not find the string inside the…
JosephF
  • 35
  • 1
4
votes
1 answer

Get file directory in Apache Velocity Template Language

CLion uses Apache's Velocity Template Language (VTL) to create templates for C++ and C files. On CLion's help (https://www.jetbrains.com/help/clion/file-template-variables.html) a bunch of variables that can be used are listed. I was wondering…
shmoo6000
  • 495
  • 4
  • 22
4
votes
1 answer

Adding to List Prints true in Velocity

I am trying to add some string values to a list in Velocity. When I run the code it works alright. But the line where it adds the value prints true. Is it always like that in Velocity? I am new to Velocity templates, so cant figure it out…
hell_storm2004
  • 1,401
  • 2
  • 33
  • 66
4
votes
1 answer

Get count of items in a velocity list

I'm creating a set of custom templates and structures for a Liferay site. One structure provides for a repeatable section, which its matching template then iterates over. However, for styling reasons, I need to know how many instances of the…
Tom
  • 8,509
  • 7
  • 49
  • 78
4
votes
2 answers

Including literal JSON content in Velocity (avoiding HTML escapes)

I'm trying to use the Velocity engine embedded in Atlassian's products (and exposed through com.atlassian.templaterenderer) to substitute a JSON value into a template. In the template, this looks a bit like the following: