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

Remove validate call after format in CLI #24224

Open
Druue opened this issue May 16, 2024 · 0 comments
Open

Remove validate call after format in CLI #24224

Druue opened this issue May 16, 2024 · 0 comments
Labels
kind/improvement An improvement to existing feature and code. team/schema Issue for team Schema. tech/typescript Issue for tech TypeScript. topic: breaking change topic: cli topic: prisma format CLI: prisma format topic: prisma6

Comments

@Druue
Copy link
Contributor

Druue commented May 16, 2024

We currently perform another validation check on the formatted schema in the CLI which can then reject the whole format if that then doesn't pass validation.

Source: cli/src/Format.ts#L58-L61

We do not do this second check in our VS Code extension, there we only run format and let the engines handle it. This second validate check can lead to confusing validation errors being emit:

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

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

model song {
  id           String    @id
  artist       String?
  title        String?
  Artist       artist?   @relation(fields: [artist], references: [id])


  @@index([artist], name: "artist_csbqvaulkkx3n7a_idx")
}

model artist {
  id           String    @id
  name         String?
  song         String?

  @@index([song], name: "song_pl7n5ch9hvpmdxp_idx")
}
image

The schema from which this validation error was raised is never shown to you and so we plan to remove this second validate call

@Druue Druue added kind/improvement An improvement to existing feature and code. topic: cli tech/typescript Issue for tech TypeScript. topic: prisma format CLI: prisma format team/schema Issue for team Schema. topic: prisma6 labels May 16, 2024
@janpio janpio changed the title Remove second validate when running format through CLI Remove second validate when running prisma format May 16, 2024
@Druue Druue changed the title Remove second validate when running prisma format Remove validate call after format in CLI May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement An improvement to existing feature and code. team/schema Issue for team Schema. tech/typescript Issue for tech TypeScript. topic: breaking change topic: cli topic: prisma format CLI: prisma format topic: prisma6
Projects
None yet
Development

No branches or pull requests

2 participants