Skip to content

Commit

Permalink
Merge pull request #573 from kmodules/imprv-err-msg
Browse files Browse the repository at this point in the history
🏃 Improve error message for list or map type
  • Loading branch information
k8s-ci-robot authored Sep 16, 2021
2 parents b5e5a82 + 8ea7124 commit e0f56c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/crd/markers/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ type StructType string

func (l ListType) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
if schema.Type != "array" {
return fmt.Errorf("must apply listType to an array")
return fmt.Errorf("must apply listType to an array, found %s", schema.Type)
}
if l != "map" && l != "atomic" && l != "set" {
return fmt.Errorf(`ListType must be either "map", "set" or "atomic"`)
Expand All @@ -115,7 +115,7 @@ func (l ListType) ApplyFirst() {}

func (l ListMapKey) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
if schema.Type != "array" {
return fmt.Errorf("must apply listMapKey to an array")
return fmt.Errorf("must apply listMapKey to an array, found %s", schema.Type)
}
if schema.XListType == nil || *schema.XListType != "map" {
return fmt.Errorf("must apply listMapKey to an associative-list")
Expand Down

0 comments on commit e0f56c6

Please sign in to comment.