-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Description
Enhancement
the kcl.GetSchemaTypeMapping
API now only support resolving schema types from a filepath
or the parent directory of the filepath
that contains the schema types.
But a KCL package may not contain schema definitions directly under the package's root path(may be deep inside the sub packages), for example, the k8s package:
➜ tree -L 2 ~/.kcl/kpm/k8s_1.27
k8s_1.27
├── api
│ ├── admissionregistration
│ ├── apiserverinternal
│ ├── apps
│ ├── authentication
│ ├── authorization
│ ├── autoscaling
│ ├── batch
│ ├── certificates
│ ├── coordination
│ ├── core
│ ├── discovery
│ ├── events
│ ├── flowcontrol
│ ├── networking
│ ├── node
│ ├── policy
│ ├── rbac
│ ├── resource
│ ├── scheduling
│ └── storage
├── apiextensions_apiserver
│ └── pkg
├── apimachinery
│ └── pkg
├── kcl.mod
├── kcl.mod.lock
├── kube_aggregator
│ └── pkg
└── vendor
To get all the schema types in a kpm package, we would like the kcl.GetSchemaTypeMapping
API to support resolving package paths
Steps to use the API
to demonstrate the feature, here's an example to show the steps to use the API and the result:
- make sure you have konfig repo locally in path , then create a
getschema.json
file with content(replace the to the real path):
{
"file": "konfig/base/pkg"
}
- call the API
curl -X POST \
http://127.0.0.1:2021/api:protorpc/KclvmService.GetSchemaType \
-H "accept: application/json" \
--data @./getschema.json
- the expected result
all the schema Types within the base/pkg
package recursively
- the result got from the current API
{
"error": "No input KCL files",
"result": null
}
Peefy