1

When making the tutorial

https://kubebyexample.com/en/learning-paths/developing-quarkus-kubernetes/templating-qute-templating-engine/rendering-periodic

the following error appears

quarkus.qute.TemplateException: Entry "count" not found in the data map in expression {count} in template reports/v1/report_01.json.template on line 5

Configuration: Quarkus 2.6.1.Final, surefire-plugin 3.0.0-M5, compiler-plugin 3.8.1

When removing the "count" from the json-template, it works perfect

I tried also another example (from Sebastian Daschner)

https://github.com/sdaschner/quarkus-playground/tree/qute-example/src/main/java/com/sebastian_daschner/entries

This works perfect with 1.3.1.Final but after updating to 2.6.1.Final the same error occurs.

Can you pls help me. Thomas

tom
  • 21
  • 2

2 Answers2

0

I had the same issue. From the documentation:

However, the keys cannot be used directly. Instead, a prefix is used to avoid possible collisions with variables from the outer scope. By default, the alias of an iterated element suffixed with an underscore is used as a prefix. For example, the hasNext key must be prefixed with it_ inside an {#each} section: {it_hasNext}.

I had to update the {count} to {it_count} or {item_count} for my application after upgrading.

{#each items}
  {it_count}. {it.name} 
  {#if it_hasNext}<br>{/if} 
{/each}

Similarly for a for loop:

{#for item in items}
  {item_count}. {item.name} 
  {#if item_hasNext}<br>{/if} 
{/each}

Quarkus reference

  • Thank you so much for the help. I didn't notice this paragraph in the docs. Sorry - will be more thoroughly next time. – tom Jan 26 '22 at 07:20
0

For the record - this breaking change got introduced in 2.5.0 and is documented in the migration guide. It's always good to read the migration guides! ;-)

Martin Kouba
  • 1,121
  • 5
  • 8