Hi @TheNilesh ,
Can you describe your use case in more detail? Are you trying to generate provider code using tfplugingen-framework from your provider code specification and want a specific field to convert to types.List in the final generated provider code?
I want to implement convert() that converts from a slice of domain objects to types.List and vice versa. Here’s the relevant source code.
nodes_data_source.go
nodesList, err := d.client.ListNodes(projectID)
if err != nil {
resp.Diagnostics.AddError("Failed to list nodes", err.Error())
return
}
state.Nodes = convert(nodesList) // I want to implement convert()
nodes_data_source_gen.go
type NodesModel struct {
Filter FilterValue `tfsdk:"filter"`
Id types.String `tfsdk:"id"`
Nodes types.List `tfsdk:"nodes"`
}
type NodesValue struct {
Id basetypes.StringValue `tfsdk:"id"`
Name basetypes.StringValue `tfsdk:"name"`
PrimaryIp basetypes.StringValue `tfsdk:"primary_ip"`
Status basetypes.StringValue `tfsdk:"status"`
state attr.ValueState
}