-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation: add documentation and use CEL pre-processor #3333
Conversation
* **default**. Usage: `default(self.x, 'DEF')`. | ||
* **oneof**. Usage: `oneof(self.x, self.y, self.z)`. This checks that 0 or 1 of these fields is set. | ||
* **index**. Usage: `self.index({}, x, z, b)`. This does `self.x.z.b` and returns `{}` if any of these is not set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the difference 'DEF' must be a concrete value whereas {} could be an expression of some sort?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both 'DEF'
and {}
are just examples of the same thing -- the default value. In one example I return a string and the other an empty object, but there is not a difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This really improves readability. It looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Depends on istio/tools#3050.
This PR adds support for a new cel pre-processor: https://github.com/howardjohn/celpp.
This avoids the need to write incredibly verbose and error prone boilerplate to workaround limitations in the CEL language.
This PR has a few commits: