MichalLytek / MichalLytek/type-graphql

Generated Resolvers Output file names are undefined for some model names

Open
#1,690 6 comments 0 reactions 0 assignees View on GitHub
Bug :bug: Community :family_man_girl:
Dominant language
TypeScript
Stars
8.1k
Forks
672
PR merge metrics
No merged PRs in 30d

Description

**Describe the Bug**
When using the `npx prisma generate` command, file names become undefined for models containing 'Integration' or 'Integrate' in their names at `generated/type-graphql/resolvers/outputs/`.

**To Reproduce**

1. Create a Prisma model with a name containing 'Integration' or 'Integrate'. `(e.g. UserIntegration)`
2. Run the `npx prisma generate` command.
3. Check the generated resolvers output or export files in the path `generated/type-graphql/resolvers/outputs/index.ts`.

**Expected Behavior**
The output files should have properly defined names for models containing 'Integration' or 'Integrate'.

**Logs**
If you create 2 models models with names containing 'Integration' or 'Integrate', during runtime, typescript throws a "duplicate identifier" error for exports. Otherwise you do not get any error.

**Environment (please complete the following information):**

- OS: Windows 11
- Node v20.12.0
- Package version 2.0.0-rc.1, 2.0.0-beta.6 (both tested)
- TypeScript version 5.4.5

**Additional Context**
This bug seems to affect the generation process under specific circumstances, particularly when model names include certain keywords like 'Integration' or 'Integrate'. Especially if there is more than one model name fitting this scenario, it can lead to issues.

Encountering this issue primarily with specific model names suggests the potential for similar occurrences with other model names.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with Prisma models such as UserIntegration, then inspect the generation path that produces generated/type-graphql/resolvers/outputs/index.ts and its exported output files. Done means model names containing Integration or Integrate generate defined, unique filenames and exports without duplicate TypeScript identifiers.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.