-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Internal] Auto generated customizable schemas #4356
Conversation
d95518b
to
8382d47
Compare
8382d47
to
a0c1e9a
Compare
a0c1e9a
to
aa7c04a
Compare
aa7c04a
to
69bc26b
Compare
69bc26b
to
99b65de
Compare
if schemaProvider, ok := v.(CustomizableSchemaProvider); ok { | ||
cs = schemaProvider.ToSchema(cs) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be raised out of this if block.
@@ -185,7 +197,11 @@ func ResourceStructToSchemaMap(ctx context.Context, v any, customizeSchema func( | |||
nestedBlockObj := typeToSchema(ctx, reflect.ValueOf(v)) | |||
|
|||
if customizeSchema != nil { | |||
cs := customizeSchema(*ConstructCustomizableSchema(nestedBlockObj)) | |||
cs := *ConstructCustomizableSchema(nestedBlockObj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs to be called on corresponding data source methods.
99b65de
to
936f841
Compare
Test Details: go/deco-tests/12596325628 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's handle follow-ups for ApplySchemaCustomizations inside of typeToSchema to avoid users having to call it recursively manually for hand-written structs.
@@ -17,6 +17,10 @@ import ( | |||
"github.com/hashicorp/terraform-plugin-framework/types" | |||
) | |||
|
|||
type CustomizableSchemaProvider interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's document this.
1315b04
to
59a31c6
Compare
59a31c6
to
6e206f9
Compare
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Changes
Tests
make test
run locallydocs/
folderinternal/acceptance