Using "Any" generates incorrect rules
See original GitHub issueConsider the following setup:
type MyType {
num: Number,
str: String,
any: Any
}
path / {
read() = true;
write() = true;
}
path /path is MyType {
read() = true();
write() = true();
}
The third property of MyType
is defined as type Any, so I would expect that, at path
in the rules, it would ensure that any
was included in a newData.hasChildren([])
statement, and then the specific .validate
rule would check to ensure that it wasn’t null. However, the following rules are generated:
{
"rules": {
"path": {
".validate": "newData.hasChildren(['num', 'str', 'any'])",
"num": {
".validate": "newData.isNumber()"
},
"str": {
".validate": "newData.isString()"
},
"$other": {
".validate": "false"
},
".read": "true()",
".write": "true()"
}
}
}
Notice the complete lack of a .validate
rule for any
, even though the parent .validate
includes it in .hasChildren()
. Because this is left out, the $other
wildcard .validate: false
rule breaks the rule generation!
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Fix Excel Conditional Formatting Problem Extra Rules
Fix Excel conditional formatting problems when extra rules are automatically created. How to remove duplicate rules and prevent them from ...
Read more >network_policy_controller.go generates incorrect iptables rules
network_policy_controller.go generates KUBE-ROUTER-INPUT filter rules with a -j RETURN when accepting traffic. This results in a return to ...
Read more >Action rule editing errors and warnings - IBM
Rule Designer searches for problems when you edit an action rule. Errors and warnings are displayed in the Problems view.
Read more >kie - Why Drools is executing incorrect rules when multiple ...
Show activity on this post. Drools seems to give incorrect results when multiple processes are run in parallel and in each process, a...
Read more >Restrict data input by using validation rules - Microsoft Support
Create a record validation rule On the Fields tab, in the Field Validation group, click Validation, and then click Record Validation Rule. Use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @mckoss - any update on this one? I just revisited some rules, used
Any
as a type, and fell into the same pitfall. Looking at the docs indicated that I wasn’t doing anything wrong, but I had to come here to remember the issue - maybe the docs could be updated in the meantime (i.e. next to “Any” there could be a warning that says not to use it, or it could be removed entirely for now)?Hi
Also bumped into this issue. I use this workaround: