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

kcl-lang / kcl-go / 33302352720
29%

Build:
DEFAULT BRANCH: main
Ran 30 Aug 2026 08:45AM UTC
Jobs 6
Files 101
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

30 Aug 2026 08:45AM UTC coverage: 28.689% (+0.4%) from 28.28%
33302352720

push

github

web-flow
feat(gen): translate JSON Schema if/then/else into KCL check statements (#584)

feat(gen): translate JSON Schema if/then/else into KCL check statements (fixes #1876)

The vendored jsonschema package supports if/then/else as a draft-2019-09
keyword but the KCL generator emitted a warning and dropped the constraints.
This change collapses each of the three subschemas into a single inline
boolean expression joined with `and`, then renders them as:

    <then-expr> if <if-expr>
    <else-expr> if not (<if-expr>)

Each expression can descend into the subschema's `properties` so the
condition may reference individual fields of the surrounding schema
(e.g. `currency == "JPY"`). When a referenced field is optional in the
parent schema, the template ANDs a truthy guard (`and <field>`) into the
check so the comparison is short-circuited instead of evaluating against
an undefined value.

The Type keyword is intentionally not translated inside the if/then/else
sub-expression: the property already has a concrete KCL type from the
surrounding schema declaration, so a runtime typeof check would either
be redundant (typed fields) or trigger on int literals vs float fields.
Dropping the typeof guard avoids spurious check failures while still
honouring every other scalar constraint keyword.

Co-authored-by: timi <timi@anonymous.local>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

107 of 143 new or added lines in 2 files covered. (74.83%)

4662 of 16250 relevant lines covered (28.69%)

1.97 hits per line

Uncovered Changes

Lines Coverage ∆ File
20
72.49
0.41% pkg/tools/gen/genkcl_jsonschema.go
16
87.57
-6.96% pkg/tools/gen/template.go
Jobs
ID Job ID Ran Files Coverage
1 33302352720.1 30 Aug 2026 08:45AM UTC 101
28.69
GitHub Action Run
2 33302352720.2 30 Aug 2026 08:45AM UTC 101
28.69
GitHub Action Run
3 33302352720.3 30 Aug 2026 08:45AM UTC 101
28.69
GitHub Action Run
4 33302352720.4 30 Aug 2026 08:45AM UTC 101
28.69
GitHub Action Run
5 33302352720.5 30 Aug 2026 08:45AM UTC 101
28.69
GitHub Action Run
6 33302352720.6 30 Aug 2026 08:45AM UTC 101
28.69
GitHub Action Run
Source Files on build 33302352720
  • Tree
  • List 101
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 4f55ef51 on github
  • Prev Build on main (#33244131822)
  • Next Build on main (#33354133901)
  • 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