databricks-cli/bundle/schema/docs.go

31 lines
482 B
Go
Raw Normal View History

2023-01-18 15:02:38 +00:00
package schema
import (
"io/ioutil"
"os"
"gopkg.in/yaml.v2"
)
type Docs struct {
Documentation string `json:"documentation"`
Children map[string]Docs `json:"children"`
}
func LoadDocs(path string) (*Docs, error) {
f, err := os.Open(path)
if err != nil {
return nil, err
}
bytes, err := ioutil.ReadAll(f)
if err != nil {
return nil, err
}
docs := Docs{}
err = yaml.Unmarshal(bytes, &docs)
if err != nil {
return nil, err
}
return &docs, nil
}