Skip to content

Commit 28fb4c5

Browse files
authored
Merge pull request #1172 from camilamacedo86/issue-group
solve issue with groups with '.' as example.com
2 parents 5b8f09f + 74c71d2 commit 28fb4c5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/scaffold/resource/resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func (r *Resource) Validate() error {
7373
}
7474

7575
r.GroupImportSafe = strings.Replace(r.Group, "-", "", -1)
76+
r.GroupImportSafe = strings.Replace(r.GroupImportSafe, ".", "", -1)
7677

7778
versionMatch := regexp.MustCompile("^v\\d+(alpha\\d+|beta\\d+)?$")
7879
if !versionMatch.MatchString(r.Version) {

pkg/scaffold/resource/resource_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ var _ = Describe("Resource", func() {
117117
Expect(instance.GroupImportSafe).To(Equal("myproject"))
118118
})
119119

120+
It("should allow dots in group names", func() {
121+
instance := &Resource{Group: "example.com", Kind: "Cat", Version: "v1"}
122+
Expect(instance.Validate()).To(Succeed())
123+
Expect(instance.GroupImportSafe).To(Equal("examplecom"))
124+
})
125+
120126
It("should keep the Resource if specified", func() {
121127
instance := &Resource{Group: "crew", Kind: "FirstMate", Version: "v1", Resource: "myresource"}
122128
Expect(instance.Validate()).To(Succeed())

0 commit comments

Comments
 (0)