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

fixed allow square brackets in reference identifier (issue #270) #271

Closed
wants to merge 5 commits into from
Closed

fixed allow square brackets in reference identifier (issue #270) #271

wants to merge 5 commits into from

Conversation

schmilmo
Copy link
Contributor

No description provided.

@@ -92,7 +92,7 @@ func (components *Components) Validate(c context.Context) (err error) {
return
}

const identifierPattern = `^[a-zA-Z0-9._-]+$`
const identifierPattern = `^[\w\[\]._-]+$`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi please see #270 (comment)

}{
{name: "valid", identifier: "User-12_3.4", isValid: true, errMsg: ""},
{name: "valid with []", identifier: "User[Admin]", isValid: true, errMsg: ""},
{name: "invalid", identifier: "User Admin", isValid: false, errMsg: ""},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like errMsg is never not empty.
Instead of all this, how about just:

	for identifier, isValid := range map[string]bool{
		"User-12_3.4": true,
		"User[Admin]": true,
		"User Admin": false,
	}{

@fenollp fenollp closed this Nov 22, 2020
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.

2 participants