Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to reference UUID fields #102

Closed
achempion opened this issue Jan 11, 2022 · 3 comments
Closed

Impossible to reference UUID fields #102

achempion opened this issue Jan 11, 2022 · 3 comments
Labels
enhancement New feature or request syntax template language syntax

Comments

@achempion
Copy link
Contributor

Describe the bug
if we have a payload like this:

{
    "u-u-i-d": 42
}

We can't reference it in a template as it gives Java.lang.NullPointerException

{%= u-u-i-d %}

Expected behavior
It would be nice to be able to reference UUID keys from the payload.

Some syntax ideas

  • {%= ['a-b'] %}
  • {%= payload['a-b'] %} (on the downside it can conflict with actual payload key from the payload)

We discussed similar issue #91 recently.

@erdos
Copy link
Owner

erdos commented Jan 13, 2022

Hi, thanks for the report! I like the first proposed idea better. I hope I can start working on it in a few days. 🙇

@erdos erdos added enhancement New feature or request syntax template language syntax labels Jan 13, 2022
@erdos
Copy link
Owner

erdos commented Jan 16, 2022

Hello, I have just released version 0.3.30. It has the new data() function that can be used to access the whole template data payload.

In your example, the value under key u-u-i-d can be accessed as: {%= data()['u-u-i-d'] %}.

@achempion
Copy link
Contributor Author

Awesome, thank you! 💚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request syntax template language syntax
Projects
None yet
Development

No branches or pull requests

2 participants