{"id":19578477,"url":"https://github.com/kcl-lang/kcl-openapi","last_synced_at":"2025-04-27T06:33:34.187Z","repository":{"id":38150346,"uuid":"488867109","full_name":"kcl-lang/kcl-openapi","owner":"kcl-lang","description":"KCL OpenAPI Integration","archived":false,"fork":false,"pushed_at":"2025-03-17T23:40:04.000Z","size":1362,"stargazers_count":9,"open_issues_count":8,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-01T13:03:42.923Z","etag":null,"topics":["kcl","openapi","swagger"],"latest_commit_sha":null,"homepage":"https://kcl-lang.io/docs/tools/cli/openapi/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kcl-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-05T07:08:18.000Z","updated_at":"2025-02-05T13:03:01.000Z","dependencies_parsed_at":"2023-07-28T13:01:59.431Z","dependency_job_id":"cde82ca4-62a8-47b9-af60-bca4645738f5","html_url":"https://github.com/kcl-lang/kcl-openapi","commit_stats":{"total_commits":51,"total_committers":6,"mean_commits":8.5,"dds":"0.33333333333333337","last_synced_commit":"9db7670c4c6b087325d79a6b9845ec09661fe85b"},"previous_names":["kcl-lang/kcl-openapi","kusionstack/kcl-openapi"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcl-lang%2Fkcl-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcl-lang%2Fkcl-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcl-lang%2Fkcl-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcl-lang%2Fkcl-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kcl-lang","download_url":"https://codeload.github.com/kcl-lang/kcl-openapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251099351,"owners_count":21536146,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kcl","openapi","swagger"],"created_at":"2024-11-11T07:11:38.825Z","updated_at":"2025-04-27T06:33:32.871Z","avatar_url":"https://github.com/kcl-lang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KCL OpenAPI\n\n[![GoDoc](https://godoc.org/github.com/kcl-lang/kcl-openapi?status.svg)](https://pkg.go.dev/kcl-lang.io/kcl-openapi)\n[![license](https://img.shields.io/github/license/kcl-lang/kcl-openapi.svg)](https://github.com/kcl-lang/kcl-openapi/blob/master/LICENSE)\n[![Coverage Status](https://coveralls.io/repos/github/kcl-lang/kcl-openapi/badge.svg)](https://coveralls.io/github/kcl-lang/kcl-openapi)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcl-lang%2Fkcl-openapi.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcl-lang%2Fkcl-openapi?ref=badge_shield)\n\nThe work on this project is mainly based on [go-swagger](https://github.com/go-swagger/go-swagger), and this project just adds some\nKCL-specific templates and language features to it. We are grateful and sincerely respectful for the outstanding work\nin [go-swagger](https://github.com/go-swagger/go-swagger). Meanwhile, we are working on making the customized features separated from the\nbasic OpenAPI logic in go-swagger.\n\nMain use cases:\n\n+ Swagger OpenAPI\n    + Translate Swagger OpenAPI spec to KCL code\n+ Kubernetes CRD\n    + Translate Kubernetes CRD to KCL code\n\n## Features\n\nThe package translates Swagger OpenAPI spec and Kubernetes CRD to KCL models.\n\n### Translate Swagger OpenAPI Spec to KCL\n\nThe package now supports [OpenAPI 2.0](https://swagger.io/specification/v2/). By parsing the \"Definitions\" section of the spec, the KCL OpenAPI\npackage will extract the defined models from it and generate the corresponding KCL representation.\n\n\u003e **Note**: The [Kubernetes KCL models](https://github.com/orgs/KusionStack/packages/container/package/k8s) among all versions are pre-generated, you get it by executing `kcl mod add k8s:\u003cversion\u003e` under your project. Alternatively, if you may want to generate them yourself, please refer [Generate KCL Packages from Kubernetes OpenAPI Specs](./docs/generate_from_k8s_spec.md).\n\n### Translate Kubernetes CRD to KCL\n\nThe package can also translate\nthe [Kubernetes CRD](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/) to KCL models.\nBy parsing the `spec.versions[n].schema.openAPIV3Schema` (n means the latest version of the spec will be used) section of the CRD, the KCL\nOpenAPI package will extract the structural schema and generate the corresponding KCL representation.\n\n## KCL OpenAPI Spec\n\nThe [KCL OpenAPI Spec](https://www.kcl-lang.io/docs/tools/cli/openapi/openapi-to-kcl) defines a complete specification of how OpenAPI objects are mapped to KCL language elements.\n\n## License\n\nApache License Version 2.0\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcl-lang%2Fkcl-openapi.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcl-lang%2Fkcl-openapi?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcl-lang%2Fkcl-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkcl-lang%2Fkcl-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcl-lang%2Fkcl-openapi/lists"}