Files
grafana/pkg/plugins/pfs/decl.go
Selene 1181141b40 Schemas: Refactor plugin's metadata (#83696)
* Remove kinds verification for kind-registry

* Read plugin's json information with json library instead of use thema binding

* Remove grafanaplugin unification

* Don't use kindsys for extract the slot name

* Fix IsGroup

* Remove all plugindef generation

* Refactor schema interfaces

* Pushed this change from a different branch by mistake...

* Create small plugin definition structure adding additional information for plugins registration

* Add some validation checks

* Delete unused code

* Fix imports lint
2024-03-07 11:09:19 +01:00

41 lines
775 B
Go

package pfs
import (
"cuelang.org/go/cue/ast"
"github.com/grafana/kindsys"
"github.com/grafana/thema"
)
type PluginDecl struct {
SchemaInterface *SchemaInterface
Lineage thema.Lineage
Imports []*ast.ImportSpec
PluginPath string
PluginMeta Metadata
KindDecl kindsys.Def[kindsys.ComposableProperties]
}
type SchemaInterface struct {
Name string
IsGroup bool
}
type Metadata struct {
Id string
Name string
Backend *bool
Version *string
}
func EmptyPluginDecl(path string, meta Metadata) *PluginDecl {
return &PluginDecl{
PluginPath: path,
PluginMeta: meta,
Imports: make([]*ast.ImportSpec, 0),
}
}
func (decl *PluginDecl) HasSchema() bool {
return decl.Lineage != nil && decl.SchemaInterface != nil
}