From 59aed8bb4dc280f592c9706f09ecc781061a3334 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Thu, 12 Sep 2024 13:14:30 -0400 Subject: [PATCH] fix(generator): adapt types generation to fix enum values (#1359) --- generator/types/types.go | 2 +- test/features/enums/schema.prisma | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/generator/types/types.go b/generator/types/types.go index 1daf1cb9c..8601117de 100644 --- a/generator/types/types.go +++ b/generator/types/types.go @@ -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. diff --git a/test/features/enums/schema.prisma b/test/features/enums/schema.prisma index 0274b06d2..fe7ee1611 100644 --- a/test/features/enums/schema.prisma +++ b/test/features/enums/schema.prisma @@ -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 {