Skip to content

Commit

Permalink
website/externaldata: fix rego snippet (#1687)
Browse files Browse the repository at this point in the history
Dashes in variable names are not allowed. `my-list` would be parsed
as `my` minus `list`.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
  • Loading branch information
srenatus committed Nov 30, 2021
1 parent ad30ce0 commit c459043
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions website/docs/externaldata.md
Expand Up @@ -96,10 +96,10 @@ External data adds a [custom OPA built-in function](https://www.openpolicyagent.
e.g.,
```rego
# build a list of keys containing images for batching
my-list := [img | img = input.review.object.spec.template.spec.containers[_].image]
my_list := [img | img = input.review.object.spec.template.spec.containers[_].image]
# send external data request
response := external_data({"provider": "my-provider", "keys": my-list})
response := external_data({"provider": "my-provider", "keys": my_list})
```

Response example: [[`"my-key"`, `"my-value"`, `""`], [`"another-key"`, `42`, `""`], [`"bad-key"`, `""`, `"error message"`]]
Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-v3.7.x/externaldata.md
Expand Up @@ -96,10 +96,10 @@ External data adds a [custom OPA built-in function](https://www.openpolicyagent.
e.g.,
```rego
# build a list of keys containing images for batching
my-list := [img | img = input.review.object.spec.template.spec.containers[_].image]
my_list := [img | img = input.review.object.spec.template.spec.containers[_].image]
# send external data request
response := external_data({"provider": "my-provider", "keys": my-list})
response := external_data({"provider": "my-provider", "keys": my_list})
```

Response example: [[`"my-key"`, `"my-value"`, `""`], [`"another-key"`, `42`, `""`], [`"bad-key"`, `""`, `"error message"`]]
Expand Down

0 comments on commit c459043

Please sign in to comment.