-
Notifications
You must be signed in to change notification settings - Fork 31
fix(consumer): add maxLength and pattern validations for KongConsumer and KongConsumerGroup
#3109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
KongConssumer and KongConsumerGroupKongConsumer and KongConsumerGroup
| // +kubebuilder:validation:MaxLength=128 | ||
| // +kubebuilder:validation:Pattern=`^[\p{L}\p{N}.\-_~+@/\[\]]+(?: [\p{L}\p{N}.\-_~+@/\[\]]+)*$` | ||
| Username string `json:"username,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field allows empty strings (omitempty), but the patterns use + quantifier requiring at least one character. I think we can use * instead of + or set MinLength=1 if we don't want empty string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i prefer to go with * approach, the minlength could be a breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjusted validation rules and added tests to cover empty username and custom_id fields
What this PR does / why we need it:
Which issue this PR fixes
Fixes #773
Special notes for your reviewer:
PR Readiness Checklist:
Complete these before marking the PR as
ready to review:CHANGELOG.mdrelease notes have been updated to reflect significant changes