Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d27b31

Browse files
committed
review feedback
1 parent 3a61f81 commit 0d27b31

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package codersdkvalidator
2+
3+
import (
4+
"github.com/coder/coder/v2/codersdk"
5+
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
6+
)
7+
8+
func GroupName() validator.String {
9+
return validatorFromFunc(codersdk.GroupNameValid, "value must be a valid group name")
10+
}

internal/codersdkvalidator/validator_from_func.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (v functionValidator) Description(_ context.Context) string {
4343
if v.err != nil {
4444
return v.err.Error()
4545
}
46-
return "value must be a valid name"
46+
return v.defaultMessage
4747
}
4848

4949
func (v functionValidator) MarkdownDescription(ctx context.Context) string {

internal/provider/group_resource.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (r *GroupResource) Schema(ctx context.Context, req resource.SchemaRequest,
7777
MarkdownDescription: "The unique name of the group.",
7878
Required: true,
7979
Validators: []validator.String{
80-
codersdkvalidator.Name(),
80+
codersdkvalidator.GroupName(),
8181
},
8282
},
8383
"display_name": schema.StringAttribute{

0 commit comments

Comments
 (0)