Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion generators/artifacthub/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ func (pkg AhPackage) GenerateComponents(group string) ([]_component.ComponentDef
continue
}
if comp.Model.Metadata == nil {
comp.Model.Metadata = &model.ModelDefinition_Metadata{}
now := time.Now()
comp.Model.Metadata = &model.ModelDefinition_Metadata{
CreatedAt: &now,
}
}

if comp.Model.Metadata.AdditionalProperties == nil {
Expand Down
6 changes: 5 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,10 @@ func (gp GitHubPackage) GenerateComponents(group string) ([]_component.Component
continue
}
if comp.Model.Metadata == nil {
comp.Model.Metadata = &model.ModelDefinition_Metadata{}
now := time.Now()
comp.Model.Metadata = &model.ModelDefinition_Metadata{
CreatedAt: &now,
}
}
if comp.Model.Metadata.AdditionalProperties == nil {
comp.Model.Metadata.AdditionalProperties = make(map[string]interface{})
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ replace (
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 (
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
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,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
15 changes: 12 additions & 3 deletions registry/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ var modelMetadataValues = []string{
func (m *ModelCSV) UpdateModelDefinition(modelDef *_model.ModelDefinition) error {
metadata := modelDef.Metadata
if metadata == nil {
metadata = &_model.ModelDefinition_Metadata{}
now := time.Now()
metadata = &_model.ModelDefinition_Metadata{
CreatedAt: &now,
}
}
if metadata.AdditionalProperties == nil {
metadata.AdditionalProperties = make(map[string]interface{})
Expand Down Expand Up @@ -626,7 +629,10 @@ func GenerateComponentsFromPkg(pkg models.Package, compDirPath string, defVersio
for _, comp := range comps {
comp.Version = defVersion
if modelDef.Metadata == nil {
modelDef.Metadata = &_model.ModelDefinition_Metadata{}
now := time.Now()
modelDef.Metadata = &_model.ModelDefinition_Metadata{
CreatedAt: &now,
}
}
if modelDef.Metadata.AdditionalProperties == nil {
modelDef.Metadata.AdditionalProperties = make(map[string]interface{})
Expand Down Expand Up @@ -918,7 +924,10 @@ 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{}
now := time.Now()
modelDef.Metadata = &_model.ModelDefinition_Metadata{
CreatedAt: &now,
}
}
if modelDef.Metadata.AdditionalProperties == nil {
modelDef.Metadata.AdditionalProperties = make(map[string]interface{})
Expand Down
3 changes: 3 additions & 0 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,7 @@ func GenerateFromOpenAPI(resource string, pkg models.Package) ([]component.Compo
}
}

now := time.Now()
c := component.ComponentDefinition{
SchemaVersion: v1beta1.ComponentSchemaVersion,
Format: component.JSON,
Expand All @@ -141,6 +143,7 @@ func GenerateFromOpenAPI(resource string, pkg models.Package) ([]component.Compo
Name: pkg.GetName(),
DisplayName: manifests.FormatToReadableString(pkg.GetName()),
Metadata: &model.ModelDefinition_Metadata{
CreatedAt: &now,
AdditionalProperties: map[string]interface{}{
"source_uri": pkg.GetSourceURL(),
},
Expand Down