hashicorp / terraform-plugin-codegen-framework

Terraform Provider Code Generation Specification to Framework
Mozilla Public License 2.0
39 stars 17 forks source link

Generation template file fixed for map_nested attribute #126

Closed mdmohan closed 8 months ago

mdmohan commented 8 months ago

Fix for https://github.com/hashicorp/terraform-plugin-codegen-framework/issues/125

hashicorp-cla commented 8 months ago

CLA assistant check
All committers have signed the CLA.

mdmohan commented 8 months ago

Hi, Thanks for checking. Sure, I'll try the testing part and get back.

mdmohan commented 8 months ago

Hi, test and changelog added.

Before Fix, with the test:

=== NAME  TestCustomNestedObjectValue_renderToObjectValue/map-nested
    custom_nested_object_test.go:1447: unexpected difference:   bytes.Join({
                "\nfunc (v ExampleValue) ToObjectValue(ctx context.Context) (baset",
                "ypes.ObjectValue, diag.Diagnostics) {\nvar diags diag.Diagnostics",
                "\n\nmapNestedAttribute := types.",
        -       "List",
        +       "Map",
                "ValueMust(\nMapNestedAttributeType{\nbasetypes.ObjectType{\nAttrTyp",
                "es: MapNestedAttributeValue{}.AttributeTypes(ctx),\n},\n},\nv.MapNe",
                "stedAttribute.Elements(),\n)\n\nif v.MapNestedAttribute.IsNull() {\n",
                "mapNestedAttribute = types.",
        -       "List",
        +       "Map",
                "Null(\nMapNestedAttributeType{\nbasetypes.ObjectType{\nAttrTypes: M",
                "apNestedAttributeValue{}.AttributeTypes(ctx),\n},\n},\n)\n}\n\nif v.Ma",
                "pNestedAttribute.IsUnknown() {\nmapNestedAttribute = types.",
        -       "List",
        +       "Map",
                "Unknown(\nMapNestedAttributeType{\nbasetypes.ObjectType{\nAttrTypes",
                ": MapNestedAttributeValue{}.AttributeTypes(ctx),\n},\n},\n)\n}\n\n\nobj",
                ... // 196 identical bytes
          }, "")
=== NAME  TestCustomNestedObjectValue_renderToObjectValue/set-nested
    custom_nested_object_test.go:1447: unexpected difference:   bytes.Join({
                "\nfunc (v ExampleValue) ToObjectValue(ctx context.Context) (baset",
                "ypes.ObjectValue, diag.Diagnostics) {\nvar diags diag.Diagnostics",
                "\n\nsetNestedAttribute := types.",
        -       "Lis",
        +       "Se",
                "tValueMust(\nSetNestedAttributeType{\nbasetypes.ObjectType{\nAttrTy",
                "pes: SetNestedAttributeValue{}.AttributeTypes(ctx),\n},\n},\nv.SetN",
                "estedAttribute.Elements(),\n)\n\nif v.SetNestedAttribute.IsNull() {",
                "\nsetNestedAttribute = types.",
        -       "Lis",
        +       "Se",
                "tNull(\nSetNestedAttributeType{\nbasetypes.ObjectType{\nAttrTypes: ",
                "SetNestedAttributeValue{}.AttributeTypes(ctx),\n},\n},\n)\n}\n\nif v.S",
                "etNestedAttribute.IsUnknown() {\nsetNestedAttribute = types.",
        -       "Lis",
        +       "Se",
                "tUnknown(\nSetNestedAttributeType{\nbasetypes.ObjectType{\nAttrType",
                "s: SetNestedAttributeValue{}.AttributeTypes(ctx),\n},\n},\n)\n}\n\n\nob",
                ... // 197 identical bytes
          }, "")
--- FAIL: TestCustomNestedObjectValue_renderToObjectValue (0.00s)
github-actions[bot] commented 6 months ago

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.