Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.0.2
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll cut the release once the PR is merged. I'm just lazy and don't want to do a second PR just to bump the version

v3.0.3
3 changes: 2 additions & 1 deletion field.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ func (f *Field) setTerraformTypeOverride(c *FieldBuildContext) {

f.ElemType = f.Type
f.ElemValueType = f.ValueType
f.ValueCastFromType = f.ValueCastToType
f.GoType = f.ValueCastFromType
f.GoElemType = f.ValueCastFromType
}
}

Expand Down
7 changes: 7 additions & 0 deletions test/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,10 @@ validators:

custom_types:
"Test.StringOverride": StringCustom

schema_types:
"Test.SchemaOverride":
type: "github.com/hashicorp/terraform-plugin-framework/types.StringType"
value_type: "github.com/hashicorp/terraform-plugin-framework/types.String"
cast_to_type: "string"
cast_from_type: "OverrideCastType"
2 changes: 2 additions & 0 deletions test/custom_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,5 @@ func CopyToStringCustom(diags diag.Diagnostics, obj string, t attr.Type, v attr.

return value
}

type OverrideCastType string
7 changes: 5 additions & 2 deletions test/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func createTestObj() *Test {
EmbeddedNestedString: "embdtest2",
},
},

SchemaOverride: "hello",
}
}

Expand Down Expand Up @@ -428,8 +430,9 @@ func copyFromTerraformObject(t *testing.T) types.Object {
types.String{Value: "b"},
types.String{Value: "c"},
}},
"foo": types.String{Null: true},
"bar": types.String{Value: "ham"},
"foo": types.String{Null: true},
"bar": types.String{Value: "ham"},
"schema_override": types.String{Value: "hello"},
},
AttrTypes: obj.AttrTypes,
}
Expand Down
156 changes: 80 additions & 76 deletions test/test.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion test/test.proto
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ message Test {
string foo = 41;
string bar = 42;
}

string SchemaOverride = 43 [
(gogoproto.jsontag) = "schema_override",
(gogoproto.casttype) = "OverrideCastType"
];
}

message MaxAgeDuration {
Expand Down Expand Up @@ -234,4 +239,4 @@ message EmbeddedField {
message EmbeddedNestedField {
// EmbeddedNestedString string field
string EmbeddedNestedString = 1 [(gogoproto.jsontag) = "embedded_nested_string"];
}
}
44 changes: 44 additions & 0 deletions test/test_terraform.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading