Skip to content
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

fix regex for topic validation #951

Merged
merged 1 commit into from
Nov 22, 2021
Merged

Conversation

iwarapter
Copy link
Contributor

There is a length requirement for topic validation otherwise the following error is thrown:

 422 Validation Failed [{Resource: Field: Code: Message:Topics must start with a lowercase letter or number, consist of 35 characters or less, and can include hyphens.}]

@jcudit jcudit added this to the v4.19.0 milestone Nov 2, 2021
@jcudit jcudit modified the milestones: v4.19.0, v4.18.1 Nov 15, 2021
@jcudit jcudit merged commit f1374da into integrations:main Nov 22, 2021
@@ -178,7 +178,7 @@ func resourceGithubRepository() *schema.Resource {
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z0-9][a-z0-9-]*$`), "must include only lowercase alphanumeric characters or hyphens and cannot start with a hyphen"),
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z0-9][a-z0-9-]{1,34}$`), "must include only lowercase alphanumeric characters or hyphens and cannot start with a hyphen and consist of 35 characters or less"),
Copy link
Contributor

@danielpops danielpops Dec 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcudit FYI there is a bug here, the {1,34} only applies to the second set, so this ends up incorrectly failing for single-character topics (e.g. c) #999

kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants