Skip to content

Commit 1ef9cb2

Browse files
committed
Update wording for write-only attribute validation errors
1 parent 46205a8 commit 1ef9cb2

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

internal/fwserver/attribute_validation.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ func AttributeValidate(ctx context.Context, a fwschema.Attribute, req ValidateAt
7474
resp.Diagnostics.AddAttributeError(
7575
req.AttributePath,
7676
"Invalid Attribute Definition",
77-
"WriteOnly Attributes must be set with either Required, or Optional. This is always a problem with the provider and should be reported to the provider developer.",
77+
"WriteOnly Attributes must be set with only one of Required or Optional. This is always a problem with the provider and should be reported to the provider developer.",
7878
)
79+
return
7980
}
8081

8182
if a.IsWriteOnly() && a.IsComputed() {
@@ -84,6 +85,7 @@ func AttributeValidate(ctx context.Context, a fwschema.Attribute, req ValidateAt
8485
"Invalid Attribute Definition",
8586
"WriteOnly Attributes cannot be set with Computed. This is always a problem with the provider and should be reported to the provider developer.",
8687
)
88+
return
8789
}
8890

8991
configData := &fwschemadata.Data{

internal/fwserver/attribute_validation_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,7 @@ func TestAttributeValidate(t *testing.T) {
18811881
diag.NewAttributeErrorDiagnostic(
18821882
path.Root("test"),
18831883
"Invalid Attribute Definition",
1884-
"WriteOnly Attributes must be set with either Required, or Optional. This is always a problem with the provider and should be reported to the provider developer.",
1884+
"WriteOnly Attributes must be set with only one of Required or Optional. This is always a problem with the provider and should be reported to the provider developer.",
18851885
),
18861886
},
18871887
},
@@ -1918,12 +1918,7 @@ func TestAttributeValidate(t *testing.T) {
19181918
diag.NewAttributeErrorDiagnostic(
19191919
path.Root("test"),
19201920
"Invalid Attribute Definition",
1921-
"WriteOnly Attributes must be set with either Required, or Optional. This is always a problem with the provider and should be reported to the provider developer.",
1922-
),
1923-
diag.NewAttributeErrorDiagnostic(
1924-
path.Root("test"),
1925-
"Invalid Attribute Definition",
1926-
"WriteOnly Attributes cannot be set with Computed. This is always a problem with the provider and should be reported to the provider developer.",
1921+
"WriteOnly Attributes must be set with only one of Required or Optional. This is always a problem with the provider and should be reported to the provider developer.",
19271922
),
19281923
},
19291924
},

0 commit comments

Comments
 (0)