diff --git a/printutils/printYaml.go b/printutils/printYaml.go index 37ad2d5..79784a9 100644 --- a/printutils/printYaml.go +++ b/printutils/printYaml.go @@ -35,7 +35,7 @@ func printResource(w io.Writer, data interface{}) error { if !ok { fmt.Fprint(w, string(yamlBytes)) } else { - wantedKeys := []string{"version", "kind", "metadata", "spec"} + wantedKeys := []string{"apiVersion", "kind", "metadata", "spec"} for _, wantedKey := range wantedKeys { printKeyYaml(w, wantedKey, asMap[wantedKey]) } diff --git a/printutils/printYaml_test.go b/printutils/printYaml_test.go index 5418425..ac077bb 100644 --- a/printutils/printYaml_test.go +++ b/printutils/printYaml_test.go @@ -8,7 +8,7 @@ import ( ) func TestPrintResourceLikeYamlOnSingleResource(t *testing.T) { - resourceFromBe := `{"spec": "someSpec", "version": "v4", "kind": "Gelato", "metadata": "arancia"}` + resourceFromBe := `{"spec": "someSpec", "apiVersion": "v4", "kind": "Gelato", "metadata": "arancia"}` var data interface{} err := json.Unmarshal([]byte(resourceFromBe), &data) if err != nil { @@ -17,7 +17,7 @@ func TestPrintResourceLikeYamlOnSingleResource(t *testing.T) { var output bytes.Buffer PrintResourceLikeYamlFile(&output, data) expected := strings.TrimSpace(` -version: v4 +apiVersion: v4 kind: Gelato metadata: arancia spec: someSpec`) @@ -52,7 +52,7 @@ cat`) } func TestPrintResourceLikeYamlOnMultileResources(t *testing.T) { - resourceFromBe := `{"spec": "someSpec", "version": "v4", "newKind": "Gelato", "metadata": "arancia"}` + resourceFromBe := `{"spec": "someSpec", "apiVersion": "v4", "newKind": "Gelato", "metadata": "arancia"}` var data interface{} err := json.Unmarshal([]byte(resourceFromBe), &data) if err != nil { @@ -61,7 +61,7 @@ func TestPrintResourceLikeYamlOnMultileResources(t *testing.T) { var output bytes.Buffer PrintResourceLikeYamlFile(&output, data) expected := strings.TrimSpace(` -version: v4 +apiVersion: v4 metadata: arancia spec: someSpec newKind: Gelato