Skip to content

Commit

Permalink
Merge pull request #835 from Azadehkhojandi/master
Browse files Browse the repository at this point in the history
minor typo fix in kind string format validation
  • Loading branch information
k8s-ci-robot authored Nov 6, 2019
2 parents f09826b + 23aeb52 commit 5cfe667
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/scaffold/v1/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (r *Resource) Validate() error {
"version must match ^v\\d+(alpha\\d+|beta\\d+)?$ (was %s)", r.Version)
}
if r.Kind != flect.Pascalize(r.Kind) {
return fmt.Errorf("kind must be camelcase (expected %s was %s)", flect.Pascalize(r.Kind), r.Kind)
return fmt.Errorf("kind must be PascalCase (expected %s was %s)", flect.Pascalize(r.Kind), r.Kind)
}

return nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/scaffold/v1/resource/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var _ = Describe("Resource", func() {
Expect(instance.Validate().Error()).To(ContainSubstring("kind cannot be empty"))
})

It("should fail if the Kind is not camel cased", func() {
It("should fail if the Kind is not pascal cased", func() {
// Base case
instance := &resource.Resource{Group: "crew", Kind: "FirstMate", Version: "v1"}
Expect(instance.Validate()).To(Succeed())
Expand All @@ -91,12 +91,12 @@ var _ = Describe("Resource", func() {
instance = &resource.Resource{Group: "crew", Kind: "firstMate", Version: "v1"}
Expect(instance.Validate()).NotTo(Succeed())
Expect(instance.Validate().Error()).To(ContainSubstring(
`kind must be camelcase (expected FirstMate was firstMate)`))
`kind must be PascalCase (expected FirstMate was firstMate)`))

instance = &resource.Resource{Group: "crew", Kind: "firstmate", Version: "v1"}
Expect(instance.Validate()).NotTo(Succeed())
Expect(instance.Validate().Error()).To(ContainSubstring(
`kind must be camelcase (expected Firstmate was firstmate)`))
`kind must be PascalCase (expected Firstmate was firstmate)`))
})

It("should default the Resource by pluralizing the Kind", func() {
Expand Down

0 comments on commit 5cfe667

Please sign in to comment.