Hello! I'm trying to define an exported variable t...
# help
Hello! I'm trying to define an exported variable that contains a list as a value like this:
Copy code
apiVersion: api.cerbos.dev/v1
description: My variable
  name: my_variable
    - foo
    - bar
However, Cerbos errors out with
/exportVariables/definitions/variable_definition: expected string, but got array]"
. Is it possible to define a static list of strings for a variable?
Hi, please try wrapping an array in single-quotes:
variable_definition: '["foo", "bar"]'
. Here, the YAML parser sees it as a string, and then CEL parses it as an array.
Ah thank you! That works 🙂
I did not know the CEL parser does additional parsing on the string, my misunderstanding
I had the same question and was looking for ways to implement it everywhere. Your answer helped me a lot. It would be nice to have a similar example in the documentation, I feel that there will be other users with the same question.
👍 2