-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
TypedSDK
- add filtering tag for removed schema items
#23415
Conversation
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.
A couple of things around naming but otherwise 👍
internal/sdk/resource_encode.go
Outdated
@@ -51,7 +54,8 @@ func recurse(objType reflect.Type, objVal reflect.Value, fieldName string, debug | |||
for i := 0; i < objType.NumField(); i++ { | |||
field := objType.Field(i) | |||
fieldVal := objVal.Field(i) | |||
if tfschemaTag, exists := field.Tag.Lookup("tfschema"); exists { | |||
if tfschemaTag, exists := field.Tag.Lookup("tfschema"); exists && !(strings.HasSuffix(tfschemaTag, ",majorVersionRemoved") && features.FourPointOh()) { |
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 a contains
- and/or we should probably split the tags on ,
?
internal/sdk/resource_encode.go
Outdated
@@ -51,7 +54,8 @@ func recurse(objType reflect.Type, objVal reflect.Value, fieldName string, debug | |||
for i := 0; i < objType.NumField(); i++ { | |||
field := objType.Field(i) | |||
fieldVal := objVal.Field(i) | |||
if tfschemaTag, exists := field.Tag.Lookup("tfschema"); exists { | |||
if tfschemaTag, exists := field.Tag.Lookup("tfschema"); exists && !(strings.HasSuffix(tfschemaTag, ",majorVersionRemoved") && features.FourPointOh()) { | |||
tfschemaTag = strings.TrimSuffix(tfschemaTag, ",majorVersionRemoved") |
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.
perhaps removedInNextMajorVersion
would be clearer?
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.
Actually could we also document this in the README too?
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. |
This PR addresses several crashes hidden behind the major version feature flag for schema changes and provides a mechanism for future deprecated schema item removal.