Skip to content

Commit

Permalink
add check for missing metadata w/signoff
Browse files Browse the repository at this point in the history
Signed-off-by: Jougan-0 <[email protected]>
  • Loading branch information
Jougan-0 committed Aug 14, 2024
1 parent ba1fa94 commit 1243ede
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions generators/artifacthub/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/layer5io/meshkit/utils/manifests"
"github.com/meshery/schemas/models/v1beta1/category"
_component "github.com/meshery/schemas/models/v1beta1/component"
"github.com/meshery/schemas/models/v1beta1/model"
"gopkg.in/yaml.v2"
)

Expand Down Expand Up @@ -53,6 +54,9 @@ func (pkg AhPackage) GenerateComponents() ([]_component.ComponentDefinition, err
if err != nil {
continue
}
if comp.Model.Metadata == nil {
comp.Model.Metadata = &model.ModelDefinition_Metadata{}
}

if comp.Model.Metadata.AdditionalProperties == nil {
comp.Model.Metadata.AdditionalProperties = make(map[string]interface{})
Expand Down
4 changes: 4 additions & 0 deletions generators/github/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/layer5io/meshkit/utils/manifests"
"github.com/meshery/schemas/models/v1beta1/category"
_component "github.com/meshery/schemas/models/v1beta1/component"
"github.com/meshery/schemas/models/v1beta1/model"
)

type GitHubPackage struct {
Expand Down Expand Up @@ -40,6 +41,9 @@ func (gp GitHubPackage) GenerateComponents() ([]_component.ComponentDefinition,
if err != nil {
continue
}
if comp.Model.Metadata == nil {
comp.Model.Metadata = &model.ModelDefinition_Metadata{}
}
if comp.Model.Metadata.AdditionalProperties == nil {
comp.Model.Metadata.AdditionalProperties = make(map[string]interface{})
}
Expand Down

0 comments on commit 1243ede

Please sign in to comment.