How can you express a multi-key object via an object comprehension? #197
Answered
by
anderseknert
bleggett
asked this question in
OPA and Rego
-
So I wanna use array and object comprehension to build a list of objects, but each object has multiple keys and for the life of me the only way I can figure out how to get this to work is via using
Am a missing a way to express multi-property objects in a single object comprehension, or is the above the only way to do this? |
Beta Was this translation helpful? Give feedback.
Answered by
anderseknert
May 14, 2022
Replies: 1 comment 1 reply
-
Hi @bleggett! Maybe I'm missing something too :) Is there some reason you need to use object comprehensions at all here? obj_list := [obj |
some attr in attrs
obj := {
"entity_identifier": attr.entity_identifier,
"entity_attributes": [{
"attribute": "https://example.org/attr/OPA/value/AddedByOPA",
"displayName": "Added By OPA"
}]
}] |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
peteroneilljr
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @bleggett! Maybe I'm missing something too :) Is there some reason you need to use object comprehensions at all here?