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

Fix logic that allows ignoring Resource and SDK setters #539

Merged
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
14 changes: 14 additions & 0 deletions pkg/generate/code/set_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,20 @@ func SetResourceForStruct(
var sourceAdaptedVarName, qualifiedTargetVar string

for _, targetMemberName := range targetShape.MemberNames() {
// To check if the field member has `ignore` set to `true`.
// This condition currently applies only for members of a field whose shape is `structure`.
var setCfg *ackgenconfig.SetFieldConfig
f, ok := r.Fields[targetFieldPath]
if ok {
mf, ok := f.MemberFields[targetMemberName]
if ok {
setCfg = mf.GetSetterConfig(op)
if setCfg != nil && setCfg.IgnoreResourceSetter() {
continue
}
}
}

sourceMemberShapeRef = sourceShape.MemberRefs[targetMemberName]
if sourceMemberShapeRef == nil {
continue
Expand Down
3 changes: 1 addition & 2 deletions pkg/generate/code/set_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ func SetSDKForStruct(
// To check if the field member has `ignore` set to `true`.
// This condition currently applies only for members of a field whose shape is `structure`
var setCfg *ackgenconfig.SetFieldConfig
f, ok := r.Fields[targetFieldName]
f, ok := r.Fields[sourceFieldPath]
if ok {
mf, ok := f.MemberFields[memberName]
if ok {
Expand All @@ -1117,7 +1117,6 @@ func SetSDKForStruct(
continue
}
}

}

fallBackName := r.GetMatchingInputShapeFieldName(op, targetFieldName)
Expand Down