-
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
Define Diagnostics type and helpers. #24
Comments
Do we want diagnostics to be an interface? Maybe a superset of the That would help address some of the validation stuff @bflad wants to do, e.g. being able to progressively enhance to support It would also allow providers to treat diagnostics more like errors, detecting on them, programming with them, allowing them to be more embedded in provider code rather than being for practitioner consumption only. We could (in theory) have an interface something like this: type Diagnostic interface {
error
DiagnosticSeverity() Severity
DiagnosticSummary() string
DiagnosticDetail() string
}
type DiagnosticWithPath interface {
Diagnostic
DiagnosticPath() tfsdk.Path
} I think that would give the framework everything it needs to construct the |
Picking this up -- especially with recent |
Do you want to start with a design doc, or do you want to head right into implementation? |
I'm thinking design documentation if time allows, but happy to also just submit a very basic starter implementation, e.g. package diag
type Diagnostic struct { /* ... */ }
type Diagnostics []Diagnostic
func (d Diagnostics) Append(...in Diagnostic)
func (d Diagnostics) HasError() bool
func (d Diagnostics) toTfprotov6Diagnostics() []*tfprotov6.Diagnostic To unblock the current situation, until we have more time to noodle on whether interface types are a good idea (it seems valuable 😄 ) and write out design ideas. |
My hot take is to do a timeboxed design document for, say, a week and let's figure out how to ship enough of an MVP to make it work if it doesn't look like the design document is getting consensus? |
Reference: #24 Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Module version
Use-cases
We want people to be able to return diagnostics and use them ergonomically, so we should provide some helper functions and ways to use them that makes it easier and less verbose to define diagnostics.
The text was updated successfully, but these errors were encountered: