diff --git a/pkg/fieldpath/path.go b/pkg/fieldpath/path.go index d6073187..7513ad4d 100644 --- a/pkg/fieldpath/path.go +++ b/pkg/fieldpath/path.go @@ -242,7 +242,17 @@ func memberShapeRef( } switch shapeRef.Shape.Type { case "structure": - return shapeRef.Shape.MemberRefs[memberName] + // We are looking for a member of a structure. Since the ACK fields and + // the AWS SDK fields may have different casing (e.g AWSVPCConfiguration + // and AwsVpcConfiguration) we need to perform a case insensitive + // comparison to find the correct member reference. + for memberRefName, memberRefShape := range shapeRef.Shape.MemberRefs { + if strings.EqualFold(memberRefName, memberName) { + return memberRefShape + } + } + // If no matching member is found, return nil. + return nil case "list": return memberShapeRef(&shapeRef.Shape.MemberRef, memberName) case "map": diff --git a/pkg/fieldpath/path_test.go b/pkg/fieldpath/path_test.go index 180b4025..5127b25a 100644 --- a/pkg/fieldpath/path_test.go +++ b/pkg/fieldpath/path_test.go @@ -148,6 +148,12 @@ func TestShapeRef(t *testing.T) { }, }, }, + "WeirdlycasEdType": &awssdkmodel.ShapeRef{ + ShapeName: "WeirdlycasEdType", + Shape: &awssdkmodel.Shape{ + Type: "string", + }, + }, }, }, } @@ -220,4 +226,11 @@ func TestShapeRef(t *testing.T) { // Calling ShapeRef should not modify the original Path require.Equal("Author.Books.ChapterPageCounts.PageCount", p.String()) + + // Case-insensitive comparisons... + p = fieldpath.FromString("Author.WeirdlyCasedType") + ref = p.ShapeRef(authShapeRef) + require.NotNil(ref) + require.Equal("WeirdlycasEdType", ref.ShapeName) + require.Equal("string", ref.Shape.Type) }