prisma-class-generator icon indicating copy to clipboard operation
prisma-class-generator copied to clipboard

Relational imports not given proper snakecased file names that match generated files

Open blaykelarue opened this issue 1 year ago • 0 comments

Expected Behavior

I am receiving numerous typescript errors because the file import declarations are incorrect. What I should be seeing:

import { OrderEntity } from 'order_entity';
import { CurrencyCode, CheckoutTransportationMethod } from '@prisma/client';
import { Money } from './money';
import { MailingAddress } from './mailing_address';

Actual Behavior

import { OrderEntity } from 'orderentity';
import { CurrencyCode, CheckoutTransportationMethod } from '@prisma/client';
import { Money } from './money';
import { MailingAddress } from './mailingaddress';

The filenames for the types that were actually generated are order_entity.ts and mailing_address.ts, so the mismatch is problematic here.

Steps to Reproduce the Problem

  1. Create Prisma schema with pascal-cased model names
  2. Generate types with PrismaClassGenerator definition:
generator prismaClassGenerator {
  provider = "prisma-class-generator"
  output  = "../src/@generated/prisma-class"
  useSwagger = false
  dryRun = false
}
  1. Done

Specifications

  • Version: 0.2.9
  • Prisma Version: 5.7.0
  • Platform: macOS

blaykelarue avatar Dec 21 '23 21:12 blaykelarue