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

kcl-lang / kcl-openapi / 35564453053
65%
main: 65%

Build:
Build:
LAST BUILD BRANCH: fix/179-crd-short-schema-names
DEFAULT BRANCH: main
Ran 21 Sep 2026 05:27AM UTC
Jobs 1
Files 21
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

21 Sep 2026 05:22AM UTC coverage: 64.723% (+0.4%) from 64.293%
35564453053

Pull #180

github

claude
feat(generator): short, organized schema names for CRD imports

Fixes #179. Importing a CRD used to produce schema names glued from the
full property path, e.g.
ArgoprojIoV1alpha1ClusterWorkflowTemplateSpecAffinityNodeAffinity...
PreferredDuringSchedulingIgnoredDuringExecutionItems0PreferenceMatchFieldsItems0.

The names came from the code generator naming anonymous inline objects
after their property path within the root definition. This change adds a
post-flatten pass (pkg/swagger/generator/names.go) that:

- renames each CRD root definition (group.version.Kind) after its Kind,
  appending the version when several versions share the Kind;
- hoists every inline complex object below the roots into its own named
  definition, named after the short root plus at most two trailing
  meaningful path segments, dropping noise segments such as array
  "items"/"0" (e.g. ClusterWorkflowTemplatePreferenceMatchFields); on
  collision the name extends towards the root (capped) and then takes a
  numeric suffix, all assigned deterministically from a shared registry;
- rewrites every local $ref accordingly. Hoisted definitions render as
  their own model file with plain same-package references.

CRD-derived definitions are recognized by an x-kcl-crd-root marker set
during CRD->swagger conversion, so bundled k8s types and plain OpenAPI
specs are untouched. --long-names restores the previous behavior.

Two related optional modes:

- --crd-dedupe-k8s (dedupe.go): CRD definitions that are structurally
  identical to a bundled k8s type (e.g. a PodSpec inlined by
  argo-workflows) become x-kcl-type aliases to the official k8s module
  instead of duplicated local schemas (166 aliases on the argo CRD from
  the issue). Structures are compared canonically: descriptions and
  ordering annotations ignored, $refs resolved recursively, required
  sorted, x-kubernetes-* extensions and constraints kept; when several
  k8s API versions collide, the shortest (stable) import path win... (continued)
Pull Request #180: feat(generator): short, organized schema names for CRD imports

3141 of 4853 relevant lines covered (64.72%)

0.73 hits per line

Coverage Regressions

Lines Coverage ∆ File
304
57.89
-3.55% pkg/swagger/generator/model.go
47
76.71
0.0% pkg/swagger/generator/shared.go
20
83.61
-0.78% pkg/swagger/generator/spec.go
17
4.05
-0.17% pkg/cmds/kcl-openapi.go
13
81.9
1.47% pkg/swagger/generator/support.go
12
54.66
1.09% pkg/kube_resource/generator/generator.go
1
56.41
-1.28% pkg/swagger/generator/structs.go
1
65.77
-0.27% pkg/swagger/generator/template_repo.go
Jobs
ID Job ID Ran Files Coverage
1 35564453053.1 21 Sep 2026 05:27AM UTC 21
64.72
GitHub Action Run
Source Files on build 35564453053
  • Tree
  • List 21
  • Changed 8
  • Source Changed 0
  • Coverage Changed 8
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #180
  • PR Base - main (#33465196655)
  • 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