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
This commit is contained in:
Selene
2024-03-07 11:09:19 +01:00
committed by GitHub
parent beea7d1c2b
commit 1181141b40
29 changed files with 181 additions and 1401 deletions
+2 -2
View File
@@ -35,10 +35,10 @@ func (j *pgoJenny) Generate(decl *pfs.PluginDecl) (*codejen.File, error) {
return nil, nil
}
slotname := strings.ToLower(decl.SchemaInterface.Name())
slotname := strings.ToLower(decl.SchemaInterface.Name)
byt, err := gocode.GenerateTypesOpenAPI(decl.Lineage.Latest(), &gocode.TypeConfigOpenAPI{
Config: &openapi.Config{
Group: decl.SchemaInterface.IsGroup(),
Group: decl.SchemaInterface.IsGroup,
Config: &copenapi.Config{
MaxCycleDepth: 10,
},
@@ -42,8 +42,8 @@ func (j *pleJenny) Generate(decl *pfs.PluginDecl) (codejen.Files, error) {
}
version := "export const pluginVersion = \"%s\";"
if decl.PluginMeta.Info.Version != nil {
version = fmt.Sprintf(version, *decl.PluginMeta.Info.Version)
if decl.PluginMeta.Version != nil {
version = fmt.Sprintf(version, *decl.PluginMeta.Version)
} else {
version = fmt.Sprintf(version, getGrafanaVersion())
}
+1 -1
View File
@@ -51,7 +51,7 @@ func (j *ptsJenny) Generate(decl *pfs.PluginDecl) (*codejen.File, error) {
Data: string(jf.Data),
})
path := filepath.Join(j.root, decl.PluginPath, fmt.Sprintf("%s.gen.ts", strings.ToLower(decl.SchemaInterface.Name())))
path := filepath.Join(j.root, decl.PluginPath, fmt.Sprintf("%s.gen.ts", strings.ToLower(decl.SchemaInterface.Name)))
data := []byte(tsf.String())
data = data[:len(data)-1] // remove the additional line break added by the inner jenny