MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / UnmarshalYAML

Method UnmarshalYAML

resources/plugin/plugin-load.go:60–89  ·  view source on GitHub ↗
(value *yaml.Node)

Source from the content-addressed store, hash-verified

58}
59
60func (p *pluginLoad) UnmarshalYAML(value *yaml.Node) error {
61
62 sorts := make([]string, 0)
63 var itemNodes []*yaml.Node
64
65 for i := 0; i < len(value.Content); i += 2 {
66 v := value.Content[i]
67 switch strings.ToLower(v.Value) {
68 case "version":
69 p.version = value.Content[i+1].Value
70 continue
71 case "sort":
72 err := value.Content[i+1].Decode(&sorts)
73 if err != nil {
74 return err
75 }
76 continue
77 case "plugin":
78 itemNodes = value.Content[i+1].Content
79
80 }
81
82 }
83 items, err := pluginItemUnmarshalYAML(sorts, itemNodes)
84 if err != nil {
85 return err
86 }
87 p.defines = items
88 return nil
89}
90func pluginItemUnmarshalYAML(sorts []string, nodes []*yaml.Node) ([]*plugin_model.Define, error) {
91 if len(nodes) == 0 {
92 return nil, fmt.Errorf("yaml: error decoding plugin is empty")

Callers

nothing calls this directly

Calls 1

pluginItemUnmarshalYAMLFunction · 0.85

Tested by

no test coverage detected