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

Feature Request: customizable behaviour on unknown value #110

Open
robbrit opened this issue Nov 29, 2021 · 3 comments
Open

Feature Request: customizable behaviour on unknown value #110

robbrit opened this issue Nov 29, 2021 · 3 comments

Comments

@robbrit
Copy link

robbrit commented Nov 29, 2021

Currently if a variable does not exist, Chevron just replaces it with an unknown value:

# This will render 'hello '
result = chevron.render('{{ value1 }} {{ value2 }}', { 'value1': 'hello' })

Is it possible to customize this? There's two main cases that would be useful:

  • Raise an error on an unknown field; this helps us fail-fast when the result is due to a misspelling.
  • Ignore the template directive, just render the text as is. So in the example above, leave it as 'hello {{ value2 }}'.

The first is useful in general; the second is useful for multi-pass rendering where we receive data at different stages, and want to render a partially-evaluated version of the template.

@robbrit
Copy link
Author

robbrit commented Nov 29, 2021

Looks like the second is supported using the keep flag, but hasn't been released yet.

@michaelrccurtis
Copy link

Looks like this release is still pending. Is this project still being maintained? Would be great to see this release being pushed, and happy to contribute a pr that raises an error in the event of unknown field if it would be welcomed?

@michaelrccurtis
Copy link

Actually, looks like someone has already contributed said PR with #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants