hashicorp / hashicorp/terraform-plugin-codegen-spec

Consider adding schema definition string method on types

Open
#23 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
12
Forks
9
Avg merge
2d 13h
Merged PRs (30d)
1

Description

In the _terraform-plugin-codegen-framework_ code strings for the types for use in generated schema are produced along the following lines:

```go
switch {
case v.Bool != nil:
if v.Bool.CustomType != nil {
aTypes.WriteString(v.Bool.CustomType.Type)
} else {
aTypes.WriteString("types.BoolType")
}
// ...
}
```

A method could be created for each of the types so that the logic for determining which string to return would be come the responsibility of the type itself rather than the caller.

For instance:

```go
switch {
case v.Bool != nil:
aTypes.WriteString(v.Bool.SchemaString)
// ...
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.