I have 'JSON' file something like below, now i want to validate is label cat is set or not?
"labels": {
"apple": "one",
"banana": "two",
"cat": "three"
}
check_against_targets(value, targets) {
mode == "allowlist"
match_mode == "regex"
not my_regexp.match_name(value, targets)
}
check_labels(labels) {
print(count(labels))
count(labels) > 0
some i
check_against_targets(labels[i])
}
with above OPA test its only taking first label and not going through all labels to validate it.
any idea where i'm going wrong (I am quite new to OPA).
expected behaviour is should go through all labels and find CAT is their or not!