Skip to content

Commit

Permalink
BUILD/MINOR: add kubebuilder command to ignore index require field
Browse files Browse the repository at this point in the history
  • Loading branch information
oktalz committed Apr 8, 2024
1 parent cc6709f commit 97accf7
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cmd/kubebuilder_marker_generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ func generate(fileName string) error { //nolint:gocognit,unparam
if strings.HasPrefix(comment, "// Format: ") {
addSimpleMarker(field, fileName, comment, "Format", "raw")
}
if strings.HasPrefix(comment, "// Required: true") {
if len(comments) == 2 && comments[0] == "// index" {
field.Decorations().Before = dst.NewLine
field.Decorations().Start.Append("// +kubebuilder:validation:Optional")
}
}

}
// if len(field.Names) > 0 {
Expand Down
1 change: 1 addition & 0 deletions models/acl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/backend_switching_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion models/capture.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/filter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/http_after_response_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/http_check.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/http_error_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/http_request_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/http_response_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/log_target.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/server_switching_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/stick_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/tcp_check.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/tcp_request_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/tcp_response_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 97accf7

Please sign in to comment.