Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ x1 = Person {
- [func ListDownStreamFiles\(workDir string, opt \*ListDepsOptions\) \(\[\]string, error\)](<#ListDownStreamFiles>)
- [func ListUpStreamFiles\(workDir string, opt \*ListDepsOptions\) \(deps \[\]string, err error\)](<#ListUpStreamFiles>)
- [func OverrideFile\(file string, specs, importPaths \[\]string\) \(bool, error\)](<#OverrideFile>)
- [func ValidateCode\(data, code string, opt \*ValidateOptions\) \(ok bool, err error\)](<#ValidateCode>)
- [func Validate\(dataFile, schemaFile string, opts \*ValidateOptions\) \(ok bool, err error\)](<#Validate>)
- [func ValidateCode\(data, code string, opts \*ValidateOptions\) \(ok bool, err error\)](<#ValidateCode>)
- [type KCLResult](<#KCLResult>)
- [type KCLResultList](<#KCLResultList>)
- [func MustRun\(path string, opts ...Option\) \*KCLResultList](<#MustRun>)
Expand Down Expand Up @@ -226,7 +227,7 @@ func main() {
</details>

<a name="GetSchemaTypeMapping"></a>
## func [GetSchemaTypeMapping](<https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L221>)
## func [GetSchemaTypeMapping](<https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L227>)

```go
func GetSchemaTypeMapping(file, code, schemaName string) (map[string]*KclType, error)
Expand Down Expand Up @@ -363,14 +364,23 @@ When the pkgpath is '__main__', it can be omitted.

importPaths. List of import statements that need to be added

<a name="Validate"></a>
## func [Validate](<https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L188>)

```go
func Validate(dataFile, schemaFile string, opts *ValidateOptions) (ok bool, err error)
```

Validate validates the given data file against the specified schema file with the provided options.

<a name="ValidateCode"></a>
## func [ValidateCode](<https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L182>)

```go
func ValidateCode(data, code string, opt *ValidateOptions) (ok bool, err error)
func ValidateCode(data, code string, opts *ValidateOptions) (ok bool, err error)
```

ValidateCode validate data match code
ValidateCode validate data string match code string

<a name="KCLResult"></a>
## type [KCLResult](<https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L54>)
Expand Down Expand Up @@ -721,7 +731,7 @@ type KclType = kcl.KclType
```

<a name="GetSchemaType"></a>
### func [GetSchemaType](<https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L204>)
### func [GetSchemaType](<https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L210>)

```go
func GetSchemaType(file, code, schemaName string) ([]*KclType, error)
Expand Down Expand Up @@ -961,7 +971,7 @@ type TestResult = testing.TestResult
```

<a name="Test"></a>
### func [Test](<https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L187>)
### func [Test](<https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L193>)

```go
func Test(testOpts *TestOptions, opts ...Option) (TestResult, error)
Expand Down
8 changes: 2 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ require (
github.com/powerman/rpc-codec v1.2.2
github.com/qri-io/jsonpointer v0.1.1
github.com/stretchr/testify v1.8.4
github.com/urfave/cli/v2 v2.25.0
github.com/wk8/go-ordered-map/v2 v2.1.8
google.golang.org/grpc v1.56.3
google.golang.org/protobuf v1.30.0
gopkg.in/yaml.v3 v3.0.1
kcl-lang.io/kpm v0.4.3
kcl-lang.io/lib v0.7.3
kcl-lang.io/kpm v0.4.6
kcl-lang.io/lib v0.7.4
)

require (
Expand All @@ -37,7 +36,6 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cloudflare/circl v1.1.0 // indirect
github.com/containerd/containerd v1.7.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/cli v23.0.1+incompatible // indirect
Expand Down Expand Up @@ -80,13 +78,11 @@ require (
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/thoas/go-funk v0.9.3 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
Expand Down
16 changes: 4 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaD
github.com/containerd/containerd v1.7.0 h1:G/ZQr3gMZs6ZT0qPUZ15znx5QSdQdASW11nXTLTM2Pg=
github.com/containerd/containerd v1.7.0/go.mod h1:QfR7Efgb/6X2BDpTPJRvPTYDE9rsF0FsXX9J8sIs/sc=
github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI=
Expand Down Expand Up @@ -354,8 +352,6 @@ github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0ua
github.com/qri-io/jsonpointer v0.1.1 h1:prVZBZLL6TW5vsSB9fFHFAMBLI4b0ri5vribQlTJiBA=
github.com/qri-io/jsonpointer v0.1.1/go.mod h1:DnJPaYgiKu56EuDp8TU5wFLdZIcAnb/uH9v37ZaMV64=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
Expand All @@ -378,14 +374,10 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/thoas/go-funk v0.9.3 h1:7+nAEx3kn5ZJcnDm2Bh23N2yOtweO14bi//dvRtgLpw=
github.com/thoas/go-funk v0.9.3/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q=
github.com/urfave/cli/v2 v2.25.0 h1:ykdZKuQey2zq0yin/l7JOm9Mh+pg72ngYMeB0ABn6q8=
github.com/urfave/cli/v2 v2.25.0/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down Expand Up @@ -750,10 +742,10 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
kcl-lang.io/kpm v0.4.3 h1:a97/l8ZSV1GQYWl2AEFOHfEDxvW406oQYKwNoZaeGuE=
kcl-lang.io/kpm v0.4.3/go.mod h1:Yu8uUz7R1NeiP8vJrLQytGVYo+EewJi4EU+rfhYiiYc=
kcl-lang.io/lib v0.7.3 h1:YsKBo5jrICQ3fJobywkB9dFfVIW/ixCAkqmYQ5Z2lqQ=
kcl-lang.io/lib v0.7.3/go.mod h1:ubsalGXxJaa5II/EsHmsI/tL2EluYHIcW+BwzQPt+uY=
kcl-lang.io/kpm v0.4.6 h1:yaQdRQMqByaxyUb3uEp27zI7xxcsnp1iIcgqU9hFVqI=
kcl-lang.io/kpm v0.4.6/go.mod h1:Ba2ijUHQR/sMdB4S7982vOrajly4LdgshrqXd2SXBog=
kcl-lang.io/lib v0.7.4 h1:D1mSGI6Ggb9B3lQqoscQuSOnaBpnkvucZA0WWWniLO0=
kcl-lang.io/lib v0.7.4/go.mod h1:ubsalGXxJaa5II/EsHmsI/tL2EluYHIcW+BwzQPt+uY=
oras.land/oras-go v1.2.3 h1:v8PJl+gEAntI1pJ/LCrDgsuk+1PKVavVEPsYIHFE5uY=
oras.land/oras-go v1.2.3/go.mod h1:M/uaPdYklze0Vf3AakfarnpoEckvw0ESbRdN8Z1vdJg=
oras.land/oras-go/v2 v2.3.0 h1:lqX1aXdN+DAmDTKjiDyvq85cIaI4RkIKp/PghWlAGIU=
Expand Down