Object union with optional parameter #46
Answered
by
srenatus
Treiblesschorle
asked this question in
OPA and Rego
-
Hi, |
Beta Was this translation helpful? Give feedback.
Answered by
srenatus
Oct 29, 2021
Replies: 1 comment 7 replies
-
You could use a rule, with one body per (defined, undefined) x (defined, undefined) pair, e.g. a = data.foo
b = input.bar
union_maybe = object.union(a, b)
union_maybe = a {
not b
}
union_maybe = b {
not a
} |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
Treiblesschorle
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could use a rule, with one body per (defined, undefined) x (defined, undefined) pair, e.g.
👉 Playground