Skip to content

Commit 0fddc34

Browse files
committed
fix test failure and add comments
1 parent e2d7f7d commit 0fddc34

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cmd/internal/codegen/parse/crd.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ func (b *APIs) parseArrayValidation(t *types.Type, found sets.String, comments [
297297
Type: "array",
298298
Items: &v1beta1.JSONSchemaPropsOrArray{Schema: &items},
299299
}
300+
// To represent byte arrays in the generated code, the property of the OpenAPI definition
301+
// should have string as its type and byte as its format.
300302
if t.Name.Name == "[]byte" {
301303
props.Type = "string"
302304
props.Format = "byte"

test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ function test_crd_validation {
530530
Alias string \`json:"alias"\`\
531531
// +kubebuilder:validation:Enum=1,2,3\
532532
Rank int \`json:"rank"\`\
533-
Comment []byte \`json:"comment"\`\
533+
Comment []byte \`json:"comment,omitempty"\`\
534534
' pkg/apis/got/v1beta1/house_types.go
535535

536536
kubebuilder generate

0 commit comments

Comments
 (0)