Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ralvs opened this issue Oct 6, 2023 · 1 comment
Open

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

ralvs opened this issue Oct 6, 2023 · 1 comment

Comments

@ralvs
Copy link

ralvs commented Oct 6, 2023

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?

@AhmedElywa
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants