Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generators/artifacthub/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (pkg AhPackage) GenerateComponents(group string) ([]_component.ComponentDef
continue
}
if comp.Model.Metadata == nil {
comp.Model.Metadata = &model.ModelDefinition_Metadata{}
comp.Model.Metadata = model.NewModelDefinition_Metadata()
}

if comp.Model.Metadata.AdditionalProperties == nil {
Expand Down
3 changes: 2 additions & 1 deletion generators/github/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package github
import (
"bytes"
"os"
"time"

"github.com/meshery/meshkit/utils"
"github.com/meshery/meshkit/utils/component"
Expand Down Expand Up @@ -73,7 +74,7 @@ func (gp GitHubPackage) GenerateComponents(group string) ([]_component.Component
continue
}
if comp.Model.Metadata == nil {
comp.Model.Metadata = &model.ModelDefinition_Metadata{}
comp.Model.Metadata = model.NewModelDefinition_Metadata()
}
if comp.Model.Metadata.AdditionalProperties == nil {
comp.Model.Metadata.AdditionalProperties = make(map[string]interface{})
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ replace (
// github.com/docker/libcompose => github.com/docker/libcompose v0.4.1-0.20190808084053-143e0f3f1ab9
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5
github.com/jaguilar/vt100 => github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305

// github.com/meshery/schemas v0.8.30 => ../schemas
)

//github.com/meshery/schemas => ../schemas

require (
cuelang.org/go v0.11.2
github.com/Masterminds/semver/v3 v3.3.1
Expand Down Expand Up @@ -44,7 +44,7 @@ require (
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/postgres v1.5.11
gorm.io/driver/sqlite v1.5.7
gorm.io/gorm v1.30.0
gorm.io/gorm v1.30.1
helm.sh/helm/v3 v3.18.4
k8s.io/api v0.33.2
k8s.io/apimachinery v0.33.2
Expand Down Expand Up @@ -199,7 +199,7 @@ require (
github.com/nats-io/nkeys v0.4.9 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/novln/docker-parser v1.0.0 // indirect
github.com/oapi-codegen/runtime v1.1.1 // indirect
github.com/oapi-codegen/runtime v1.1.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/openshift/api v3.9.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,6 @@ github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lL
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/meshery/schemas v0.8.34 h1:RiD5JWWQE92d8nkEWy7Lt0guZRAG3XQstX07spfPw7w=
github.com/meshery/schemas v0.8.34/go.mod h1:6BxRPapEnbH4ATuneUVLb7lOAWSdr8gyvNp1zAgmyKA=
github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM=
github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
Expand Down Expand Up @@ -425,8 +423,8 @@ github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/novln/docker-parser v1.0.0 h1:PjEBd9QnKixcWczNGyEdfUrP6GR0YUilAqG7Wksg3uc=
github.com/novln/docker-parser v1.0.0/go.mod h1:oCeM32fsoUwkwByB5wVjsrsVQySzPWkl3JdlTn1txpE=
github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro=
github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg=
github.com/oapi-codegen/runtime v1.1.2 h1:P2+CubHq8fO4Q6fV1tqDBZHCwpVpvPg7oKiYzQgXIyI=
github.com/oapi-codegen/runtime v1.1.2/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg=
github.com/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU=
github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk=
github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8=
Expand Down Expand Up @@ -698,8 +696,8 @@ gorm.io/driver/postgres v1.5.11 h1:ubBVAfbKEUld/twyKZ0IYn9rSQh448EdelLYk9Mv314=
gorm.io/driver/postgres v1.5.11/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkweRGI=
gorm.io/driver/sqlite v1.5.7 h1:8NvsrhP0ifM7LX9G4zPB97NwovUakUxc+2V2uuf3Z1I=
gorm.io/driver/sqlite v1.5.7/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDah4=
gorm.io/gorm v1.30.0 h1:qbT5aPv1UH8gI99OsRlvDToLxW5zR7FzS9acZDOZcgs=
gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=
gorm.io/gorm v1.30.1 h1:lSHg33jJTBxs2mgJRfRZeLDG+WZaHYCk3Wtfl6Ngzo4=
gorm.io/gorm v1.30.1/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=
gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
helm.sh/helm/v3 v3.18.4 h1:pNhnHM3nAmDrxz6/UC+hfjDY4yeDATQCka2/87hkZXQ=
Expand Down
6 changes: 3 additions & 3 deletions registry/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var modelMetadataValues = []string{
func (m *ModelCSV) UpdateModelDefinition(modelDef *_model.ModelDefinition) error {
metadata := modelDef.Metadata
if metadata == nil {
metadata = &_model.ModelDefinition_Metadata{}
metadata = _model.NewModelDefinition_Metadata()
}
if metadata.AdditionalProperties == nil {
metadata.AdditionalProperties = make(map[string]interface{})
Expand Down Expand Up @@ -626,7 +626,7 @@ func GenerateComponentsFromPkg(pkg models.Package, compDirPath string, defVersio
for _, comp := range comps {
comp.Version = defVersion
if modelDef.Metadata == nil {
modelDef.Metadata = &_model.ModelDefinition_Metadata{}
modelDef.Metadata = _model.NewModelDefinition_Metadata()
}
if modelDef.Metadata.AdditionalProperties == nil {
modelDef.Metadata.AdditionalProperties = make(map[string]interface{})
Expand Down Expand Up @@ -918,7 +918,7 @@ func InvokeGenerationFromSheet(wg *sync.WaitGroup, path string, modelsheetID, co
// i.e., If model is enabled, comps are also "enabled". Ultimately, all individual comps will have the ability to control their status.
// The status "enabled" indicates that the component will be registered inside the registry.
if modelDef.Metadata == nil {
modelDef.Metadata = &_model.ModelDefinition_Metadata{}
modelDef.Metadata = _model.NewModelDefinition_Metadata()
}
if modelDef.Metadata.AdditionalProperties == nil {
modelDef.Metadata.AdditionalProperties = make(map[string]interface{})
Expand Down
12 changes: 7 additions & 5 deletions utils/component/openapi_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"strings"
"time"

"cuelang.org/go/cue"
"cuelang.org/go/cue/cuecontext"
Expand Down Expand Up @@ -121,6 +122,11 @@ func GenerateFromOpenAPI(resource string, pkg models.Package) ([]component.Compo
}
}

metadata := model.NewModelDefinition_Metadata()
if metadata.AdditionalProperties == nil {
metadata.AdditionalProperties = make(map[string]interface{})
}
metadata.AdditionalProperties["source_uri"] = pkg.GetSourceURL()
c := component.ComponentDefinition{
SchemaVersion: v1beta1.ComponentSchemaVersion,
Format: component.JSON,
Expand All @@ -140,11 +146,7 @@ func GenerateFromOpenAPI(resource string, pkg models.Package) ([]component.Compo
},
Name: pkg.GetName(),
DisplayName: manifests.FormatToReadableString(pkg.GetName()),
Metadata: &model.ModelDefinition_Metadata{
AdditionalProperties: map[string]interface{}{
"source_uri": pkg.GetSourceURL(),
},
},
Metadata: metadata,
},
}

Expand Down