What you will do
You will run the prepared expression in the playground above, change one input at a time, and explain the result. Start in CEL only, then repeat the same rule in CEL + JSON.
How it works
startsWith(), endsWith(), and contains() answer different questions. The example demands a path under docs/, a Markdown suffix, and the exact fragment /guide. These checks are case-sensitive and do not normalize path separators.
Read the prepared example
The CEL + JSON rule is:
path.startsWith('docs/') && path.endsWith('.md') && path.contains('/guide')Its input is:
{
"path": "docs/cel/guide.md"
}The CEL only tab contains the values and the rule in one expression. The enabled cel.bind() extension keeps each name local to its final argument.
Evaluation step by step
- The prefix check is true.
- The suffix and contained-fragment checks are also true.
- All three booleans joined by
&&returntrue.
Your task
- Run the example.
- Change
.mdto.txtand identify the failed check. - Change
guidetoGuideand observe case sensitivity.
Expected observation: Either change makes the whole expression false for a specific, explainable reason.
Common mistake
Do not replace a clear prefix or suffix check with a regular expression unless the rule genuinely needs a pattern.
Show the explanation
No. It only proves that the fragment occurs somewhere in the string.
Knowledge check
Does contains("docs") prove that a path starts in the docs/ directory?
Key takeaway
Choose the string method that states the exact question; simple methods are usually easier to review.
Sources
CEL-DEV— official CEL overview.CEL-LANG— official CEL language definition.CEL-GO-BIND— official documentation for the optionalcel.bind()extension used by the self-contained tab.