diff --git a/VERSION b/VERSION index 77dd692..a076e7f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.5.0-dev \ No newline at end of file +v0.5.1 \ No newline at end of file diff --git a/internal/ocm-cli/ocm.go b/internal/ocm-cli/ocm.go index 7dfba1c..a010fee 100644 --- a/internal/ocm-cli/ocm.go +++ b/internal/ocm-cli/ocm.go @@ -96,7 +96,7 @@ type Component struct { // Version is the version of the component. Version string `json:"version"` // ComponentReferences is a list of references to other components that this component depends on. - ComponentReferences []ComponentReference `yaml:"componentReferences"` + ComponentReferences []ComponentReference `json:"componentReferences"` // Resources is a list of resources associated with this component, including their names, versions, types, and access information. Resources []Resource `json:"resources"` } diff --git a/internal/ocm-cli/ocm_test.go b/internal/ocm-cli/ocm_test.go index 6eaa4a6..c073f21 100644 --- a/internal/ocm-cli/ocm_test.go +++ b/internal/ocm-cli/ocm_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "k8s.io/apimachinery/pkg/util/json" "k8s.io/utils/ptr" ocmcli "github.com/openmcp-project/bootstrapper/internal/ocm-cli" @@ -114,6 +115,19 @@ func TestGetComponentVersion(t *testing.T) { MediaType: ptr.To("application/octet-stream"), }, }) + + cvMarshaled, err := json.Marshal(cv) + assert.NoError(t, err) + assert.NotNil(t, cvMarshaled) + + var cvAsMap map[string]interface{} + err = json.Unmarshal(cvMarshaled, &cvAsMap) + assert.NoError(t, err) + assert.NotNil(t, cvAsMap) + assert.Contains(t, cvAsMap, "component") + assert.Contains(t, cvAsMap["component"], "componentReferences") + comp := cvAsMap["component"].(map[string]interface{}) + assert.Len(t, comp["componentReferences"], 2) }, }, {