diff --git a/types/convert/convert.go b/types/convert/convert.go index eacf930b..98b2a985 100644 --- a/types/convert/convert.go +++ b/types/convert/convert.go @@ -76,6 +76,14 @@ func Capitalize(s string) string { return strings.ToUpper(s[:1]) + s[1:] } +func Uncapitalize(s string) string { + if len(s) <= 1 { + return strings.ToLower(s) + } + + return strings.ToLower(s[:1]) + s[1:] +} + func LowerTitle(input string) string { runes := []rune(input) for i := 0; i < len(runes); i++ { diff --git a/types/schema_funcs.go b/types/schema_funcs.go index b4543df1..837e0ee9 100644 --- a/types/schema_funcs.go +++ b/types/schema_funcs.go @@ -25,6 +25,10 @@ func (s *Schema) CanList() bool { return slice.ContainsString(s.CollectionMethods, http.MethodGet) } +func (s *Schema) CanCreate() bool { + return slice.ContainsString(s.CollectionMethods, http.MethodPost) +} + func (s *Schema) CanUpdate() bool { return slice.ContainsString(s.ResourceMethods, http.MethodPut) }