2023-01-20 15:55:44 +00:00
|
|
|
package schema
|
|
|
|
|
|
|
|
import (
|
2023-01-23 14:00:11 +00:00
|
|
|
_ "embed"
|
2023-01-20 15:55:44 +00:00
|
|
|
"os"
|
|
|
|
|
2023-01-23 14:00:11 +00:00
|
|
|
"gopkg.in/yaml.v3"
|
2023-01-20 15:55:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Docs struct {
|
|
|
|
Documentation string `json:"documentation"`
|
|
|
|
Children map[string]Docs `json:"children"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func LoadDocs(path string) (*Docs, error) {
|
|
|
|
bytes, err := os.ReadFile(path)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
docs := Docs{}
|
|
|
|
err = yaml.Unmarshal(bytes, &docs)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &docs, nil
|
|
|
|
}
|
2023-01-23 14:00:11 +00:00
|
|
|
|
|
|
|
//go:embed bundle_config_docs.yml
|
|
|
|
var bundleDocs []byte
|
|
|
|
|
|
|
|
func GetBundleDocs() (*Docs, error) {
|
|
|
|
docs := Docs{}
|
|
|
|
err := yaml.Unmarshal(bundleDocs, &docs)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &docs, nil
|
|
|
|
}
|