-
Notifications
You must be signed in to change notification settings - Fork 94
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
tfsdk: Return warning diagnostic when using Attribute
or Schema
type DeprecationMessage
field
#93
Conversation
…ype `DeprecationMessage` field Reference: #71
tfsdk/attribute.go
Outdated
@@ -344,4 +344,13 @@ func (a Attribute) validate(ctx context.Context, req ValidateAttributeRequest, r | |||
return | |||
} | |||
} | |||
|
|||
if a.DeprecationMessage != "" { |
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.
Wouldn't we only want to return the error if the value wasn't null
?
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.
Yes, we would! Good catch. Testing updated to catch this:
--- FAIL: TestAttributeValidate (0.00s)
--- FAIL: TestAttributeValidate/deprecation-message-null (0.00s)
attribute_test.go:1313: Unexpected response (+wanted, -got): tfsdk.ValidateAttributeResponse{
- Diagnostics: []*tfprotov6.Diagnostic{
- &{
- Severity: s"WARNING",
- Summary: "Attribute Deprecated",
- Detail: "Use something else instead.",
- Attribute: s`AttributeName("test")`,
- },
- },
+ Diagnostics: nil,
}
Fix will be included in next commit.
tfsdk/attribute_test.go
Outdated
@@ -803,6 +803,39 @@ func TestAttributeValidate(t *testing.T) { | |||
}, | |||
resp: ValidateAttributeResponse{}, | |||
}, | |||
"deprecation-message": { |
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.
Would love to see a test for when the value is:
- present
- absent
- unknown
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Closes #71