Skip to content
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

Merged
merged 6 commits into from
Oct 9, 2023

Conversation

jackofallops
Copy link
Member

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.

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a 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 👍

@@ -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()) {
Copy link
Contributor

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 ,?

@@ -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")
Copy link
Contributor

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?

Copy link
Contributor

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?

@tombuildsstuff tombuildsstuff added this to the v3.76.0 milestone Oct 5, 2023
@jackofallops jackofallops merged commit 0b84d31 into main Oct 9, 2023
21 checks passed
@jackofallops jackofallops deleted the b/fourpointoh-schema-crash-fix branch October 9, 2023 04:43
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants