Skip to content

Commit

Permalink
docs: mention that default functions may not evaluate
Browse files Browse the repository at this point in the history
Fixes open-policy-agent#6265

Signed-off-by: Anders Eknert <anders@styra.com>
  • Loading branch information
anderseknert committed Jun 10, 2024
1 parent fea2647 commit 11c5e45
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/content/policy-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,7 @@ count(input.x) with count as 3 with input as {}

The `default` keyword allows policies to define a default value for documents
produced by rules with [Complete Definitions](#complete-definitions). The
default value is used when all of the rules sharing the same name are undefined.
default value is used when all the rules sharing the same name are undefined.

For example:

Expand Down Expand Up @@ -2112,6 +2112,12 @@ function satisfies the following properties:
* arguments should only be plain variables ie. no composite values
* argument names should not be repeated

{{< info >}}
A `default` function will still fail (as in not evaluate, even to the default value) if any of the arguments provided in
the call are **undefined**. The reason for this is that the arguments are evaluated before the function is even called,
and an undefined argument halts evaluation at that point.
{{< /info >}}

## Else Keyword

The ``else`` keyword is a basic control flow construct that gives you control
Expand Down

0 comments on commit 11c5e45

Please sign in to comment.