-
Notifications
You must be signed in to change notification settings - Fork 14
feat: add domain name validation regex and unit tests #1043
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?
feat: add domain name validation regex and unit tests #1043
Conversation
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.
Pull request overview
This pull request adds domain name format validation to the Power Platform environment resource by introducing a regex pattern that enforces domain names to start with a lowercase letter and contain only lowercase letters, numbers, and hyphens. The PR adds corresponding unit tests to verify valid and invalid domain formats.
Changes:
- Added
DomainNameRegexconstant to enforce domain naming rules - Applied regex validation to the
dataverse.domainattribute in the environment resource schema - Added two unit tests: one for valid domain format and one for invalid characters
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| internal/helpers/regex.go | Added new DomainNameRegex constant with pattern ^[a-z][a-z0-9-]*$ |
| internal/services/environment/resource_environment.go | Applied RegexMatches validator to domain attribute with descriptive error message |
| internal/services/environment/resource_environment_test.go | Added two unit tests for domain format validation: one with valid format and one with invalid characters |
…produced-inconsistent-result-after-apply
Fixes #1031
Added a domain format regex and apply it to
dataverse.domainvalidation in the environment resource.Added unit tests to cover valid lowercase domains and invalid domain characters.