You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.Net Target (if relevant, please specify the version in the description)
.Net (5 or after)
A clear and concise description of the bug.
After an if (or switch) statement that checks if a variable/key exists, the then statement throws an unknown context value error even though the if check was false. For example, the sample for defined() on the json-e page works in the online playground there but causes this error in JsonE.Net.
What did you expect?
When an if or switch statement evaluates false, errors should not be thrown for non-existent values in the untaken branch.
Please add test code or steps to reproduce the behavior.
Here are a few tests in the more-tests.yml format that fail, and my understanding from reading the spec and using the online playground is that they should pass:
---
title: if defined checkcontext: {y: 10}template: {$if: 'defined("x")', then: {$eval: 'x'}, else: 20}result: 20
---
title: switch defined checkcontext: {y: 10}template: {$switch: {'defined("x")': {$eval: 'x'}, $default: 20}}result: 20
The template can be copied to the playground to verify that at least in their implementation, this is supported.
Is there any other information you'd like to share regarding this bug?
If this issue is accepted, it'd be great for these tests to be incorporated in the official json-e test suite in case it exists in other implementations.
Code of Conduct & Contributor Guidelines
I agree to follow this project's Code of Conduct and Contribution Guidelines.
The text was updated successfully, but these errors were encountered:
Nuget Package
JsonE.Net
Package Version
2.1.0
Operating System
Windows
.Net Target (if relevant, please specify the version in the description)
.Net (5 or after)
A clear and concise description of the bug.
After an if (or switch) statement that checks if a variable/key exists, the
then
statement throws anunknown context value
error even though theif
check was false. For example, the sample fordefined()
on the json-e page works in the online playground there but causes this error in JsonE.Net.What did you expect?
When an
if
orswitch
statement evaluates false, errors should not be thrown for non-existent values in the untaken branch.Please add test code or steps to reproduce the behavior.
Here are a few tests in the
more-tests.yml
format that fail, and my understanding from reading the spec and using the online playground is that they should pass:The
template
can be copied to the playground to verify that at least in their implementation, this is supported.Is there any other information you'd like to share regarding this bug?
If this issue is accepted, it'd be great for these tests to be incorporated in the official json-e test suite in case it exists in other implementations.
Code of Conduct & Contributor Guidelines
The text was updated successfully, but these errors were encountered: