Skip to content
Merged
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
31 changes: 15 additions & 16 deletions pkg/model/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,27 +458,26 @@ func (r *CRD) GetWrapperOutputShape(
return shape, nil
}
fieldPathParts := strings.Split(fieldPath, ".")
for x, wrapperField := range fieldPathParts {
for memberName, memberRef := range shape.MemberRefs {
if memberName == wrapperField {
if memberRef.Shape.Type != "structure" {
// All the mentionned shapes must be structure
return nil, fmt.Errorf(
"Expected SetOutput.WrapperFieldPath to only contain fields of type 'structure'."+
" Found %s of type '%s'",
memberName, memberRef.Shape.Type,
)
}
remainPath := strings.Join(fieldPathParts[x+1:], ".")
return r.GetWrapperOutputShape(memberRef.Shape, remainPath)
}
}
wrapperField := fieldPathParts[0]

memberRef, ok := shape.MemberRefs[wrapperField]
if !ok {
return nil, fmt.Errorf(
"Incorrect SetOutput.WrapperFieldPath. Could not find %s in Shape %s",
wrapperField, shape.ShapeName,
)
}
return shape, nil

if memberRef.Shape.Type != "structure" {
// All the mentioned shapes must be structure
return nil, fmt.Errorf(
"Expected SetOutput.WrapperFieldPath to only contain fields of type 'structure'."+
" Found %s of type '%s'",
wrapperField, memberRef.Shape.Type,
)
}
remainPath := strings.Join(fieldPathParts[1:], ".")
return r.GetWrapperOutputShape(memberRef.Shape, remainPath)
}

// GetCustomImplementation returns custom implementation method name for the
Expand Down