diff --git a/README.md b/README.md index f33e0a5..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,41 +0,0 @@ -# Please set your repository in file: -- .golangci.yml - -# Add secret in your Gihub -- GITHUB_TOKEN in dependabot_changelog -- CHANGELOG_PAT in generate_changelog.yml (to Push on main) -- DOC_PAT in page.yml (to generate documentation) - -# Show example below: - -
- - Latest release - - - Last commit - - - Stars - - - Issues - -
- -## terraform-plugin-framework-supertype - -supertype is a custom type of Terraform type issue from Terraform schema, like SuperShema it's a meta Objet and function to permit you to manipulate Go object and Terrform object. - -This is a try to solve these issues : - -* CustomType is defined in the Schema on each Attributes fields on resources and datasources. -* Each kind of Terraform Type is take into account: -* * Simple: String, Bool, Int64, Float64 -* * Array: List, Map, Set -* * Nested: ListNested, MapNested, SetNested, SingleNested - - -### Documentation - -For more information about the supertype, please refer to the [documentation](https://github.frangipane.io/terraform/supertype/why). \ No newline at end of file diff --git a/single_nested_type.go b/single_nested_type.go index b1727b9..4cd76f3 100644 --- a/single_nested_type.go +++ b/single_nested_type.go @@ -23,18 +23,29 @@ type SingleNestedType struct { } func (t SingleNestedType) Equal(o attr.Type) bool { - other, ok := o.(basetypes.ObjectType) + switch o.(type) { + case SingleNestedType: + other, ok := o.(SingleNestedType) + if !ok { + return false + } - if !ok { + return t.ObjectType.Equal(other.ObjectType) + case basetypes.ObjectType: + other, ok := o.(basetypes.ObjectType) + if !ok { + return false + } + + return t.ObjectType.Equal(other) + default: return false } - - return t.ObjectType.Equal(other) } func (t SingleNestedType) String() string { var res strings.Builder - res.WriteString("types.ObjectType[") + res.WriteString("supertypes.SingleNestedType[") keys := make([]string, 0, len(t.AttrTypes)) for k := range t.AttrTypes { keys = append(keys, k) @@ -80,3 +91,8 @@ func (t SingleNestedType) ValueFromTerraform(ctx context.Context, in tftypes.Val return value, nil } + +func (t SingleNestedType) ValueType(ctx context.Context) attr.Value { + // SingleNestedValue defined in the value type section + return SingleNestedValue{} +} \ No newline at end of file