Skip to content

Conversation

@sandromodarelli
Copy link
Contributor

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:

  • the CHANGELOG.md release notes have been updated to reflect significant changes

@sandromodarelli sandromodarelli changed the title fix(consumer): add maxLength and pattern validations for KongConssumer and KongConsumerGroup fix(consumer): add maxLength and pattern validations for KongConsumer and KongConsumerGroup Jan 29, 2026
@sandromodarelli sandromodarelli marked this pull request as ready for review January 29, 2026 12:53
@sandromodarelli sandromodarelli requested a review from a team as a code owner January 29, 2026 12:53
Comment on lines 47 to 49
// +kubebuilder:validation:MaxLength=128
// +kubebuilder:validation:Pattern=`^[\p{L}\p{N}.\-_~+@/\[\]]+(?: [\p{L}\p{N}.\-_~+@/\[\]]+)*$`
Username string `json:"username,omitempty"`
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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

@sandromodarelli sandromodarelli requested review from a team and tao12345666333 January 29, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limits of fields in KongConsumer and KongConsumerGroup

3 participants