You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# 2. Unzip the package and add the binary location to PATH
51
-
export PATH="<Your directory to store KCLOpenAPI binary>:$PATH"
52
-
```
53
-
54
20
## Features
55
21
56
-
The tool translates Swagger OpenAPI spec and Kubernetes CRD to KCL models.
22
+
The package translates Swagger OpenAPI spec and Kubernetes CRD to KCL models.
57
23
58
24
### Translate Swagger OpenAPI Spec to KCL
59
25
60
-
The tool now supports [OpenAPI 2.0](https://swagger.io/specification/v2/). By parsing the "Definitions" section of the spec, the KCL OpenAPI
61
-
tool will extract the defined models from it and generate the corresponding KCL representation.
62
-
63
-
The command is as follows:
64
-
65
-
```shell
66
-
kcl-openapi generate model -f ${your_open_api_spec} -t ${the_kcl_files_output_dir}
67
-
```
26
+
The package now supports [OpenAPI 2.0](https://swagger.io/specification/v2/). By parsing the "Definitions" section of the spec, the KCL OpenAPI
27
+
package will extract the defined models from it and generate the corresponding KCL representation.
68
28
69
-
> **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 `kpm add k8s:<version>` under your project. For detailed information about kpm usage, please refer to [kpm quick start guide](https://github.com/kcl-lang/kpm#quick-start).
70
-
Alternatively, if you may want to generate them yourself, please refer [Generate KCL Packages from Kubernetes OpenAPI Specs](./docs/generate_from_k8s_spec.md).
29
+
> **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:<version>` 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).
71
30
72
31
### Translate Kubernetes CRD to KCL
73
32
74
-
The tool can also translate
33
+
The package can also translate
75
34
the [Kubernetes CRD](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/) to KCL models.
76
35
By parsing the `spec.versions[n].schema.openAPIV3Schema` (n means the latest version of the spec will be used) section of the CRD, the KCL
77
-
OpenAPI tool will extract the structural schema and generate the corresponding KCL representation.
78
-
79
-
The command is as follows:
80
-
81
-
```shell
82
-
kcl-openapi generate model --crd -f ${your_CRD.yaml} -t ${the_kcl_files_output_dir} --skip-validation
83
-
```
36
+
OpenAPI package will extract the structural schema and generate the corresponding KCL representation.
84
37
85
38
## KCL OpenAPI Spec
86
39
87
40
The [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.
88
41
89
-
## Ask for help
90
-
91
-
If the tool isn't working as you expect, please reach out to us by filing an [issue](https://github.com/kcl-lang/kcl-openapi/issues).
0 commit comments