prisma-nestjs-graphql icon indicating copy to clipboard operation
prisma-nestjs-graphql copied to clipboard

Unsupported Prisma Fields Break Input Generation

Open Jrodseth opened this issue 8 months ago • 1 comments

Given a Prisma definition with an 'Unsupported' field, like this

model Feature {
  /// @Validator.IsUUID()
  /// @HideField({ match: 'Feature@(Create|Update)*Input' })
  id                 String                   @id @unique @default(dbgenerated("gen_random_uuid()")) @db.Uuid
  geometry           Unsupported("geometry(Polygon, 4326)") @map("geometry")
  /// @Validator.IsString()
  name           String 
}

All of the create and update input files will not be generated.

If the Unsupported field is commented out, the create and update files are created.

I would expect adding the HideField annotation to fix the problem:

model Feature {
  /// @Validator.IsUUID()
  /// @HideField({ match: 'Feature@(Create|Update)*Input' })
  id                 String                   @id @unique @default(dbgenerated("gen_random_uuid()")) @db.Uuid
  /// @HideField({ input: true, output: true })
  geometry           Unsupported("geometry(Polygon, 4326)") @map("geometry")
  /// @Validator.IsString()
  name           String 
}

However, the create and update input types are still not generated.

It would be great to either ignore Unsupported fields by default during generation or respect the @HideField annotation for them.

Jrodseth avatar Dec 12 '23 18:12 Jrodseth