Skip to content

Checking if a some value exists across many arrays which are selected as input. #446

Discussion options

You must be logged in to vote

Hi @avo-sepp 👋 There are many ways to do that, but here's an example: https://play.openpolicyagent.org/p/CHr9VZ9fa7

package play

import future.keywords.contains
import future.keywords.if
import future.keywords.in

map := {"key1": ["string1", "string2"], "key2": ["string3", "string4"], "key3": ["string1", "string3"]}

matches contains match if {
    some key in input.keyInput
    some match in map[key]
    match in data.stringValues
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@avo-sepp
Comment options

@anderseknert
Comment options

Answer selected by avo-sepp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants