• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kcl-lang / kcl-openapi / 33133717168
64%

Build:
DEFAULT BRANCH: main
Ran 28 Aug 2026 01:45AM UTC
Jobs 2
Files 18
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Aug 2026 01:43AM UTC coverage: 67.234% (-0.3%) from 67.544%
33133717168

push

github

web-flow
feat: translate x-kubernetes-validations (CEL) into KCL check rules (fixes #22) (#161)

* feat: translate x-kubernetes-validations (CEL) into KCL check rules (fixes #22)

Adds a CEL -> KCL translator that converts each rule in
`x-kubernetes-validations` into a KCL boolean expression inside the
generated schema's `check:` block. The original message is preserved
as a KCL comment so operators still see the validation intent in the
output.

Supported CEL constructs (the subset commonly used by CRDs):
  * literals (int, float, string, bool)
  * identifiers, field access (`self.foo.bar`), indexing
  * comparisons and logical operators (`&&` -> and, `||` -> or, `!` -> not)
  * arithmetic
  * function calls: size -> len, matches -> _regex_match, startsWith,
    endsWith, has
  * higher-order: all -> `all v in xs { ... }`,
    exists -> `any v in xs { ... }`,
    exists_one -> `sum([1 for v in xs if P]) == 1`
  * ternary `a ? b : c` -> `(b) if (a) else (c)`

Unsupported constructs (e.g. `duration()`, `isURL()`) are skipped with
a `[WARN]` and the rule is omitted so generated KCL remains compilable.

Files:
  * cel.go / cel_test.go: tokenizer, parser, AST, code generator, tests
  * k8s_validations.go: extracts and translates the extension
  * structs.go: new CheckExpr / sharedValidations.CheckExprs
  * model.go: wires extractK8sValidations into schemaValidations
  * templates/schemabody.gotmpl: emits the translated `check:` block
  * types.go: xK8sValidations constant

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claude <timi@noreply.anthropic.com>

* refactor: replace hand-rolled CEL parser with cel-go library

The previous cel.go (~580 LOC) implemented a hand-written lexer,
recursive-descent parser, and AST walker for CEL. cel-go already
provides all of these (lexer, parser, macro expansion, and a
protobuf AST), and re-implementing them meant we had to maintain our
own grammar alongside an actively-maintained upstream one.

Replace ... (continued)

220 of 343 new or added lines in 5 files covered. (64.14%)

2803 of 4169 relevant lines covered (67.23%)

1.47 hits per line

Uncovered Changes

Lines Coverage ∆ File
107
62.46
pkg/swagger/generator/cel.go
9
73.53
pkg/swagger/generator/k8s_validations.go
4
61.25
0.13% pkg/swagger/generator/model.go
2
74.3
74.3% pkg/utils/integrate_gen.go
1
4.23
-0.06% pkg/cmds/kcl-openapi.go
Jobs
ID Job ID Ran Files Coverage
1 33133717168.1 28 Aug 2026 01:45AM UTC 18
67.23
GitHub Action Run
2 33133717168.2 28 Aug 2026 01:45AM UTC 18
64.04
GitHub Action Run
Source Files on build 33133717168
  • Tree
  • List 18
  • Changed 6
  • Source Changed 0
  • Coverage Changed 6
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 38cf9866 on github
  • Prev Build on main (#33054453119)
  • Next Build on main (#33298129937)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc