kimjbstar / prisma-class-generator

Class generator from Prisma schema.
180 stars 50 forks source link

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

Open blaykelarue opened 11 months ago

blaykelarue commented 11 months ago

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
    }
  3. Done

Specifications

tnexlor commented 1 month ago

@blaykelarue same with me. I wonder how to fix this 😢

tnexlor commented 1 month ago

@blaykelarue I investigated and create a PR. #73