File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1+ apiVersion : v1
2+ kind : ConfigMap
3+ metadata :
4+ name : unconventional-keys
5+ data :
6+ 5 : " integer"
7+ 3.14 : " float"
8+ true : " boolean"
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ func TestValidateValidInputs(t *testing.T) {
2828 "quantity.yaml" ,
2929 "extra_property.yaml" ,
3030 "full_domain_group.yaml" ,
31+ "unconventional_keys.yaml" ,
3132 }
3233 for _ , test := range tests {
3334 filePath , _ := filepath .Abs ("../fixtures/" + test )
@@ -51,6 +52,7 @@ func TestValidateValidInputsWithCache(t *testing.T) {
5152 "quantity.yaml" ,
5253 "extra_property.yaml" ,
5354 "full_domain_group.yaml" ,
55+ "unconventional_keys.yaml" ,
5456 }
5557 schemaCache := make (map [string ]* gojsonschema.Schema , 0 )
5658
@@ -89,7 +91,6 @@ func TestStrictCatchesAdditionalErrors(t *testing.T) {
8991 }
9092}
9193
92-
9394func TestValidateMultipleVersions (t * testing.T ) {
9495 Strict = true
9596 Version = "1.14.0"
@@ -171,4 +172,3 @@ func TestSkipCrdSchemaMiss(t *testing.T) {
171172 t .Errorf ("For custom CRD's with schema missing we should skip with SkipCrdSchemaMiss flag" )
172173 }
173174}
174-
Original file line number Diff line number Diff line change 11package kubeval
22
3+ import "fmt"
4+
35// Based on https://stackoverflow.com/questions/40737122/convert-yaml-to-json-without-struct-golang
46// We unmarshal yaml into a value of type interface{},
57// go through the result recursively, and convert each encountered
@@ -10,7 +12,7 @@ func convertToStringKeys(i interface{}) interface{} {
1012 case map [interface {}]interface {}:
1113 m2 := map [string ]interface {}{}
1214 for k , v := range x {
13- m2 [k .( string )] = convertToStringKeys (v )
15+ m2 [fmt . Sprintf ( "%v" , k )] = convertToStringKeys (v )
1416 }
1517 return m2
1618 case []interface {}:
You can’t perform that action at this time.
0 commit comments