hashicorp / hashicorp/terraform-plugin-framework

attr: Consider Dropping context.Context from Value Type() Method

Open
#521 1 comment 1 reaction 0 assignees View on GitHub
breaking-change tech-debt
Dominant language
Go
Stars
384
Forks
107
Avg merge
3m
Merged PRs (30d)
1

Description

### Module version

```
v0.14.0
```

### Use-cases

`attr.Value` in the framework type system must be able to return their associated `attr.Type`. This is handled via the `Type(context.Context) attr.Type` method today. While the appropriate `context.Context` is generally available, there are places where it may not be, such as `types` package value creation functions.

### Attempted Solutions

Either adding `context.Context` to all potential callers that may eventually call `Type()` or working around it via:

```go
ctx := context.Background()
// ... Type(ctx) ...
```

### Proposal

Type information _should_ be very static and not require special logic where the `context.Context` is especially helpful (e.g. logging). Therefore, we may be able to drop the parameter to remove this awkwardness.

### References

- https://github.com/hashicorp/terraform-plugin-framework/pull/502#discussion_r1002972093

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.