diff --git a/pkg/generators/markers.go b/pkg/generators/markers.go index c91bc8f3a..1dddbced2 100644 --- a/pkg/generators/markers.go +++ b/pkg/generators/markers.go @@ -24,6 +24,7 @@ import ( "strconv" "strings" + defaultergen "k8s.io/gengo/examples/defaulter-gen/generators" "k8s.io/gengo/types" openapi "k8s.io/kube-openapi/pkg/common" "k8s.io/kube-openapi/pkg/validation/spec" @@ -207,8 +208,13 @@ func parseMarkers(markerComments []string, prefix string) (map[string]any, error newKey := strings.TrimPrefix(key, prefix) // Skip ref markers - if len(value) == 1 && regexp.MustCompile(`^(?:\s*ref\s{0,1}\().*\)\s*`).MatchString(value[0]) { - continue + if len(value) == 1 { + foo := value[0] + fmt.Printf("foo: %v\n", foo) + _, ok := defaultergen.ParseSymbolReference(value[0], "") + if ok { // regexp.MustCompile(`^(?:\s*ref\s{0,1}\().*\)\s*`).MatchString(value[0]) { + continue + } } if len(newKey) == 0 { return nil, fmt.Errorf("cannot have empty key for marker comment") diff --git a/pkg/generators/markers_test.go b/pkg/generators/markers_test.go index 7b6ffa263..791c0b692 100644 --- a/pkg/generators/markers_test.go +++ b/pkg/generators/markers_test.go @@ -143,7 +143,7 @@ func TestParseCommentTags(t *testing.T) { t: &numKind, name: "ignore refs", comments: []string{ - "+k8s:validation:pattern=ref(\"asdf\")", + "+k8s:validation:pattern=ref(asdf)", }, }, }