Skip to content

Commit

Permalink
fix(generator): adapt types generation to fix enum values (#1359)
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen authored Sep 12, 2024
1 parent f4a972e commit 59aed8b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion generator/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (t Type) Value() string {
return v
}

return gocase.ToUpper(strcase.ToUpperCamel(str))
return gocase.ToUpper(str)
}

// GoCase transforms strings into Go-style lowercase casing. It is like GoCase but used for private fields.
Expand Down
20 changes: 14 additions & 6 deletions test/features/enums/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ generator db {
package = "enums"
}

enum ServerOS {
Unknown
Linux
Windows
Mac
}

model User {
id String @id @default(cuid()) @map("_id")
role Role
roleOpt Role?
stuff1 Stuff?
stuff2 Stuff?
stuff3 Stuff?
id String @id @default(cuid()) @map("_id")
role Role
roleOpt Role?
stuff1 Stuff?
stuff2 Stuff?
stuff3 Stuff?
serverOS ServerOS?
}

enum Role {
Expand Down

0 comments on commit 59aed8b

Please sign in to comment.