Skip to content

Commit

Permalink
Made GeneratedFileCase's casing conversion during config parsing instead
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipJakab committed Feb 14, 2024
1 parent d389f7d commit d875acb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ func GetAndValidateConfig() (*Config, error) {
config.DbContextTemplate = joinIfRelative(config.PathBase, config.DbContextTemplate)
config.ModelTemplate = joinIfRelative(config.PathBase, config.ModelTemplate)
config.OutputFolder = joinIfRelative(config.PathBase, config.OutputFolder)
config.GeneratedFileCase = strings.ToLower(config.GeneratedFileCase)

if !contains(ValidCaseNormalized, strings.ToLower(config.GeneratedFileCase)) {
if !contains(ValidCaseNormalized, config.GeneratedFileCase) {
return nil, fmt.Errorf(" '%s' is not valid case (maybe GeneratedFileCase is missing)", config.GeneratedFileCase)
}

Expand Down
2 changes: 1 addition & 1 deletion src/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func generateFileHashes(outputFolder string) (*map[string]string, error) {
}

func changeCase(str string, desiredCase string) string {
switch strings.ToLower(desiredCase) {
switch desiredCase {
case "pascalcase":
return strcase.UpperCamelCase(str)
case "camelcase":
Expand Down

0 comments on commit d875acb

Please sign in to comment.