prisma-tools icon indicating copy to clipboard operation
prisma-tools copied to clipboard

[sdl generator] Error when model name is in lower case

Open ralvs opened this issue 1 year ago • 1 comments

I'm getting an strange error while trying to generate SDL files and I can't understand why.

schema.prisma

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model sd_cargo {
  id   Int    @id @default(autoincrement())
  nome String @db.VarChar
}

pal.config.js

module.exports = {
  backend: {
    generator: 'sdl',
    onDelete: true,
    output: 'graphql/generated',
    javaScript: true,
  },
}

Error

◣ Generating your files    SyntaxError: Syntax Error: Expected Name, found ")". (7:24)
       5 |
       6 | type Query {
    >  7 |     findUniqueSd_cargo(): sd_cargo
         |                        ^
       8 |     findFirstSd_cargo(): sd_cargo
       9 |     findManySd_cargo(): [sd_cargo!]!
      10 |     findManySd_cargoCount(): Int!

If I change the model name to:

  • sdcargo -> error
  • Sd_cargo -> works fine

Any idea?

ralvs avatar Oct 06 '23 18:10 ralvs

We are working with prisma recommendation with a model name starting with a capital letter.

AhmedElywa avatar Dec 18 '23 22:12 AhmedElywa