From 8ea7124322f38e5915490d1fb83534fdcfaa2292 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Thu, 13 May 2021 14:40:10 -0700 Subject: [PATCH] Improve error message for list or map type Signed-off-by: Tamal Saha --- pkg/crd/markers/topology.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/crd/markers/topology.go b/pkg/crd/markers/topology.go index c5a3b80e9..0f4a94b18 100644 --- a/pkg/crd/markers/topology.go +++ b/pkg/crd/markers/topology.go @@ -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"`) @@ -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")