#Value of enum changed after code generation

1 messages · Page 1 of 1 (latest)

old ginkgo
#

Hello Amplication support team, In Prisma file, we define the enum value in all UPPERCASE (e.g. COMPANY), but after code generation, through api, only can query Uppercase (e.g. Company), please see attached screenshot. Thank you!

austere spruce
#

hi @old ginkgo
let me make sure I understand :
you created a field of type option set, and you set all values in UpperCase
then you see the generated prisma schema in upper case, as expected
but the graphql API is using Pascal Case instead of all upper?

#

if that is the case - this is expected and by design
if you go to your server code and open the Enum decleration file you will see somethign like this

export enum QueryMode {
Default = "DEFAULT",
Insensitive = "INSENSITIVE",
}

the values should be uper case, but the typescript object that is also exposed in gql is following TS formatting

old ginkgo
#

Hi Yuval

#

i used this file upload to amplication to generate entities directly, it went through , and generated code, but value of enum changed from COMPANY to Company

#

got it

austere spruce
#

ok, I understand
I will add this for review and see what we need to fix.
for a workaround, you can go to the imported entity, and change the values manually in the specific field

old ginkgo
#

yes , i 'm doing it manuall right now. As our frontend code directly refer the prisma file to generate api calls.

#

do you know where i can find this setting: export enum QueryMode {
Default = "DEFAULT",
Insensitive = "INSENSITIVE",
}

austere spruce
#

look in the module folder under src
something line
src/organization/base/Enum[FieldName...]

old ginkgo
#

got it