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

kcl-lang / kcl-openapi / 33054399940
64%

Build:
DEFAULT BRANCH: main
Ran 27 Aug 2026 08:33AM UTC
Jobs 2
Files 15
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

27 Aug 2026 08:31AM UTC coverage: 66.848% (+4.1%) from 62.738%
33054399940

push

github

web-flow
feat: --existing-models flag reuses pre-generated KCL models (fixes #18) (#160)

* feat: --existing-models flag reuses pre-generated KCL models (fixes #18)

Add a repeatable `--existing-models <alias>=<dir>` CLI option (and the
underlying GenOpts.ExistingModels field). For each directory the scanner
walks *.k files, extracts `schema <Name>` declarations, and records
them in a map keyed by the simple name. When the generator later
encounters a spec definition whose simple name matches, it skips the
file generation and instead emits `import <alias>` plus references of
the form `<alias>.<SchemaName>` for any $refs to it.

The behavior is wired through:
  - new LoadExistingModels helper in existing.go
  - newTypeResolverWith in types.go to seed the resolver with the map
  - resolveSchemaRef / resolveObject short-circuits to the alias
  - makeGenDefinitionHierarchy returns an External stub for matches

Tests cover: schema-name extraction, alias uniqueness, duplicate-name
detection, end-to-end reuse with a $ref'd model, and the no-match
baseline.

Signed-off-by: Claude <timi@noreply.anthropic.com>

* fix(generator): include both directories in LoadExistingModels conflict error

When a schema name is declared in two existing-model directories the
error used to print a placeholder `"<other>"` for the previous
directory. Track the source path of each schema and include both
absolute paths plus aliases in the message so operators can locate
the duplicates immediately.

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

* test(generator): assert error message names both dirs/aliases

The "schema in multiple aliases fails" subtest only asserted that some
error was returned. Strengthen it to require the new error format
(both directories plus both aliases are present), so the "<other>"
placeholder regression cannot reappear unnoticed.

Co-Authored-By: Claude Opus ... (continued)

97 of 117 new or added lines in 5 files covered. (82.91%)

33 existing lines in 2 files now uncovered.

2462 of 3683 relevant lines covered (66.85%)

1.47 hits per line

Uncovered Changes

Lines Coverage ∆ File
10
4.29
-0.63% pkg/cmds/kcl-openapi.go
6
83.78
pkg/swagger/generator/existing.go
2
80.43
-0.29% pkg/swagger/generator/support.go
2
83.82
0.6% pkg/swagger/generator/types.go

Coverage Regressions

Lines Coverage ∆ File
32
53.57
0.49% pkg/kube_resource/generator/generator.go
1
83.82
0.6% pkg/swagger/generator/types.go
Jobs
ID Job ID Ran Files Coverage
1 33054399940.1 27 Aug 2026 08:33AM UTC 15
66.85
GitHub Action Run
2 33054399940.2 27 Aug 2026 08:33AM UTC 15
63.26
GitHub Action Run
Source Files on build 33054399940
  • Tree
  • List 15
  • Changed 7
  • Source Changed 0
  • Coverage Changed 7
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 080011dd on github
  • Prev Build on main (#33054296020)
  • Next Build on main (#33054453119)
  • 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