MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / ValidateRegistry

Function ValidateRegistry

internal/pluginstore/registry.go:166–185  ·  view source on GitHub ↗
(registry Registry)

Source from the content-addressed store, hash-verified

164}
165
166func ValidateRegistry(registry Registry) error {
167 if registry.SchemaVersion != SchemaVersion && registry.SchemaVersion != SchemaVersionV2 {
168 return fmt.Errorf("unsupported schema_version %d", registry.SchemaVersion)
169 }
170 seen := make(map[string]struct{}, len(registry.Plugins))
171 for index, plugin := range registry.Plugins {
172 if registry.SchemaVersion == SchemaVersion && PluginInstallType(plugin) == InstallTypeDirect {
173 return fmt.Errorf("plugins[%d]: direct install requires schema_version %d", index, SchemaVersionV2)
174 }
175 if errValidate := ValidatePlugin(plugin); errValidate != nil {
176 return fmt.Errorf("plugins[%d]: %w", index, errValidate)
177 }
178 id := strings.TrimSpace(plugin.ID)
179 if _, exists := seen[id]; exists {
180 return fmt.Errorf("plugins[%d]: duplicate plugin id %q", index, id)
181 }
182 seen[id] = struct{}{}
183 }
184 return nil
185}
186
187func ValidatePlugin(plugin Plugin) error {
188 required := map[string]string{

Calls 2

PluginInstallTypeFunction · 0.70
ValidatePluginFunction · 0.70