prisma/prisma

Remove validate call after format in CLI

Druue opened this issue · 0 comments

Druue commented

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