From 7fefbf740eae7e0d0ed5457d0c94d9d772817e88 Mon Sep 17 00:00:00 2001 From: Steve Kuznetsov Date: Thu, 29 Feb 2024 09:19:17 -0700 Subject: [PATCH] cel: provide example map validations Signed-off-by: Steve Kuznetsov --- content/en/docs/reference/using-api/cel.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/en/docs/reference/using-api/cel.md b/content/en/docs/reference/using-api/cel.md index 4be0fab37b..fd6460ea78 100644 --- a/content/en/docs/reference/using-api/cel.md +++ b/content/en/docs/reference/using-api/cel.md @@ -55,10 +55,12 @@ Example CEL expressions: | `has(self.expired) && self.created + self.ttl < self.expired` | Validate that 'expired' date is after a 'create' date plus a 'ttl' duration | | `self.health.startsWith('ok')` | Validate a 'health' string field has the prefix 'ok' | | `self.widgets.exists(w, w.key == 'x' && w.foo < 10)` | Validate that the 'foo' property of a listMap item with a key 'x' is less than 10 | -| `type(self) == string ? self == '99%' : self == 42` | Validate an int-or-string field for both the int and string cases | +| `type(self) == string ? self == '99%' : self == 42` | Validate an int-or-string field for both the int and string cases | | `self.metadata.name == 'singleton'` | Validate that an object's name matches a specific value (making it a singleton) | | `self.set1.all(e, !(e in self.set2))` | Validate that two listSets are disjoint | | `self.names.size() == self.details.size() && self.names.all(n, n in self.details)` | Validate the 'details' map is keyed by the items in the 'names' listSet | +| `self.details.all(key, key.matches('^[a-zA-Z]*$')` | Validate the keys of the 'details' map | +| `self.details.all(key, self.details[key].matches('^[a-zA-Z]*$')` | Validate the values of the 'details' map | {{< /table >}} ## CEL options, language features, and libraries