Skip to content

Commit 9164c07

Browse files
committed
minor #20314 [Validator] feat(when constraint): add context variable (KoNekoD)
This PR was merged into the 7.2 branch. Discussion ---------- [Validator] feat(when constraint): add context variable Issue: #20312 Commits ------- 3df3849 feat(when constraint): add context variable
2 parents a1f38ce + 3df3849 commit 9164c07

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

reference/constraints/When.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,16 @@ validation of constraints won't be triggered.
163163
To learn more about the expression language syntax, see
164164
:doc:`/reference/formats/expression_language`.
165165

166-
Depending on how you use the constraint, you have access to 1 or 2 variables
166+
Depending on how you use the constraint, you have access to 1 or 3 variables
167167
in your expression:
168168

169169
``this``
170170
The object being validated (e.g. an instance of Discount).
171171
``value``
172172
The value of the property being validated (only available when
173173
the constraint is applied to a property).
174+
``context``
175+
This is the context that is used in validation
174176

175177
The ``value`` variable can be used when you want to execute more complex
176178
validation based on its value:

0 commit comments

Comments
 (0)