hashicorp / hashicorp/terraform-plugin-framework

Consider exposing interfaces under `./internal/fwschema`

Open
#1,031 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
384
Forks
107
Avg merge
3m
Merged PRs (30d)
1

Description

### Module version

```
v1.11.0
```

### Use-cases

As a framework provider developer, I'd like to make some toolings based on the provider/datasource/resource schema definitions. The tool runs from with in the provider, and inspect different dimensions on the schemas.

Currently, the schemas have the following hierarchy:

```
terraform-plugin-framework/[resource|datasource|provider]/schema.Schema ------------------- impl --> | terraform-plugin-framework/internal/fwschema.Schema
| |
| |
composed of internal
| |
v |
terraform-plugin-framework/[resource|datasource|provider]/schema.[Attribute|Block|...] --- impl --> | terraform-plugin-framework/internal/fwschema.[Attribute|Block|...]
```

It makes me have to duplicate the same code that processing the `[resource|datasource|provider].[Schema|Attribute|Block]` three times, as long as I want to define some intermidiate function/type that aims to hold any of these types. What I actually want is to use those internal interfaces types instead, so that I only need to maintain one code.

### Attempted Solutions

Duplicates the logic to 3 copies.

### Proposal

Exposing those interfaces in `./internal/fwschema` package.

### References

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.