diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/helper.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/helper.go index 9c5344cdb..6a1f7da0c 100644 --- a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/helper.go +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/helper.go @@ -1065,7 +1065,7 @@ func collectMarkers(comments []string, into map[string][]string) { into["validation"] = append(into["validation"], "default="+v) } case line == optionalMarker: - into["validation"] = append(into["validation"], "optional") + into["validation"] = append(into["validation"], "optional=true") case strings.HasPrefix(line, listTypeMarker): if v := line[len(listTypeMarker):]; v != "" { into["validation"] = append(into["validation"], "listType="+v) diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go index 58201cafa..ff61d0842 100644 --- a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go @@ -70,10 +70,6 @@ func crd_crd_gen_generators_testdata_crd_gen_Dummy() *v1.CustomResourceDefinitio "spec": { Type: "object", Required: []string{ - "integer", - "float", - "string", - "bool", "integerPointer", "floatPointer", "stringPointer", diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go.expected b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go.expected index 58201cafa..ff61d0842 100644 --- a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go.expected +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go.expected @@ -70,10 +70,6 @@ func crd_crd_gen_generators_testdata_crd_gen_Dummy() *v1.CustomResourceDefinitio "spec": { Type: "object", Required: []string{ - "integer", - "float", - "string", - "bool", "integerPointer", "floatPointer", "stringPointer", diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/expected.yaml b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/expected.yaml index 0d426eac7..883ae86fa 100644 --- a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/expected.yaml +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/expected.yaml @@ -284,10 +284,6 @@ spec: nullable: true type: string required: - - integer - - float - - string - - bool - integerPointer - floatPointer - stringPointer