mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-11 17:56:37 +08:00
feat(core): implement context service hub and generic ioc container
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Manifest defines the metadata and dependency declarations for a plugin.
|
||||
type Manifest struct {
|
||||
// Name is the unique identifier for the plugin (e.g. "auth", "user", "order").
|
||||
Name string `json:"name" yaml:"name"`
|
||||
|
||||
// Version is the semantic version string of the plugin (e.g. "1.0.0").
|
||||
Version string `json:"version,omitempty" yaml:"version,omitempty"`
|
||||
|
||||
// Description gives a brief summary of the plugin capabilities.
|
||||
Description string `json:"description,omitempty" yaml:"description,omitempty"`
|
||||
|
||||
// Author specifies the author or maintainer of the plugin.
|
||||
Author string `json:"author,omitempty" yaml:"author,omitempty"`
|
||||
|
||||
// Dependencies lists the plugin names that this plugin depends on.
|
||||
Dependencies []string `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
|
||||
|
||||
// Metadata holds arbitrary plugin-specific metadata.
|
||||
Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
// Validate checks whether the manifest satisfies basic integrity requirements.
|
||||
func (m Manifest) Validate() error {
|
||||
if strings.TrimSpace(m.Name) == "" {
|
||||
return fmt.Errorf("%w: %w", ErrInvalidManifest, ErrInvalidManifestName)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user