Core: Remove thema and kindsys dependencies (#84499)

* Move some thema code inside grafana

* Use new codegen instead of thema for core kinds

* Replace TS generator

* Use new generator for go types

* Remove thema from oapi generator

* Remove thema from generators

* Don't use kindsys/thema for core kinds

* Remove kindsys/thema from plugins

* Remove last thema related

* Remove most of cuectx and move utils_ts into codegen. It also deletes wire dependency

* Merge plugins generators

* Delete thema dependency 🎉

* Fix CODEOWNERS

* Fix package name

* Fix TS output names

* More path fixes

* Fix mod codeowners

* Use original plugin's name

* Remove kindsys dependency 🎉

* Modify oapi schema and create an apply function to fix elasticsearch errors

* cue.mod was deleted by mistake

* Fix TS panels

* sort imports

* Fixing elasticsearch output

* Downgrade oapi-codegen library

* Update output ts files

* More fixes

* Restore old elasticsearch generated file and skip its generation. Remove core imports into plugins

* More lint fixes

* Add codeowners

* restore embed.go file

* Fix embed.go
This commit is contained in:
Selene
2024-03-21 11:11:29 +01:00
committed by GitHub
parent 856e410480
commit 473898e47c
56 changed files with 1433 additions and 1631 deletions
+4 -18
View File
@@ -18,25 +18,20 @@ func (jenny *K8ResourcesJenny) JennyName() string {
return "K8ResourcesJenny"
}
func (jenny *K8ResourcesJenny) Generate(cueFiles []CueSchema) (codejen.Files, error) {
func (jenny *K8ResourcesJenny) Generate(cueFiles ...SchemaForGen) (codejen.Files, error) {
files := make(codejen.Files, 0)
for _, val := range cueFiles {
pkg, err := getPackageName(val.CueFile)
resource, err := jenny.genResource(val.Name, val.CueFile)
if err != nil {
return nil, err
}
resource, err := jenny.genResource(pkg, val.CueFile)
metadata, err := jenny.genMetadata(val.Name)
if err != nil {
return nil, err
}
metadata, err := jenny.genMetadata(pkg)
if err != nil {
return nil, err
}
status, err := jenny.genStatus(pkg)
status, err := jenny.genStatus(val.Name)
if err != nil {
return nil, err
}
@@ -100,15 +95,6 @@ func (jenny *K8ResourcesJenny) genStatus(pkg string) (codejen.File, error) {
return *codejen.NewFile(fmt.Sprintf("pkg/kinds/%s/%s_status_gen.go", pkg, pkg), buf.Bytes(), jenny), nil
}
func getPackageName(val cue.Value) (string, error) {
name := val.LookupPath(cue.ParsePath("name"))
pkg, err := name.String()
if err != nil {
return "", fmt.Errorf("file doesn't have name field set: %s", err)
}
return pkg, nil
}
func getVersion(val cue.Value) (string, error) {
val = val.LookupPath(cue.ParsePath("lineage.schemas[0].version"))
versionValues, err := val.List()