-
Notifications
You must be signed in to change notification settings - Fork 95
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: Initial support for Attribute, Data Source, Provider, and Resource validation #75
Conversation
) | ||
|
||
// DataSourceConfigValidator describes reusable DataSource configuration validation functionality. | ||
type DataSourceConfigValidator interface { |
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.
Hot take: is Config
necessary here, or can we save some typing by removing it?
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.
I'm certainly amenable to updating the name, I'm just not sure if there's any concerns with keeping the names and types relatively close to the RPCs similar to as has been done elsewhere. Should there be any future other implementations with differing semantics, it could be weird to have DataSourceValidator
vs DataSourceStateValidator
for example.
I'm going to address the above comments and pull in the |
Co-authored-by: Paddy <paddy@hashicorp.com>
…d ResourceConfigValidator description comments
… ValidateResourceConfigRequest
This now includes the initial |
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.
Seems like it's on the right path to me.
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.
LGTM, great work @bflad.
|
||
attribute.validate(ctx, attributeReq, attributeResp) | ||
|
||
resp.Diagnostics = attributeResp.Diagnostics |
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.
Should this append instead, in case multiple attribute validators return warning diags?
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.
Initially this was appending, but I was asked to switch it to "passthrough" diagnostics: #75 (comment)
Personally I think pre-populating a response, while offering overwrite capabilities easily, could be confusing for implementors to understand the semantics. We could offer prior diagnostics in the request with diagnostic modifications in the response to clarify things on both sides of these calls (or not allow diagnostic modification). Please let me know if you would like me to raise an issue regarding this.
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. |
Reference: #17
Reference: #65