Skip to content

Commit

Permalink
Improve error message for list or map type
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed May 13, 2021
1 parent 9cd8c28 commit 8ea7124
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 8ea7124

Please sign in to comment.