Skip to content
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

Consider exposing interfaces under ./internal/fwschema #1031

Open
magodo opened this issue Aug 28, 2024 · 2 comments
Open

Consider exposing interfaces under ./internal/fwschema #1031

magodo opened this issue Aug 28, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@magodo
Copy link

magodo commented Aug 28, 2024

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

@magodo magodo added the enhancement New feature or request label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants
@magodo and others