Azure / Azure/template-analyzer
[BUG] Regex and In operators report incorrectly when inside a "not" expression and evaluated path is missing
- Dominant language
- C#
- Stars
- 143
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
If a rule has something like the following:
```js
"anyOf": [
{
"not": {
"path": "notDefinedProperty",
"in": [1, 2]
}
},
{
"not": {
"path": "notDefinedProperty",
"regex": "someValue"
}
}
]
```
the rule will incorrectly fail for this JSON:
```js
{
"definedProperty": "anything"
}
```
Logically, the rule should pass because, even though "notDefinedProperty" is not defined, it still meets the criteria of:
- does not have a value of 1 or 2
- does not match the regex of "someValue"
### Expected behavior
A path evaluated by "in" and "regex" should pass if they are negated and the path they are evaluating is not defined.
### Reproduction Steps
See description.
### Environment
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.