dotansimha / dotansimha/graphql-code-generator-community
[RTK-Query] Hook generator does not match InjectedAPI typings when typings are not in pascalCase
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
### Which packages are impacted by your issue?
@graphql-codegen/typescript-rtk-query
### Describe the bug
Either straight up remove or add a toggle to disable the automatic pascal-casing that the hook is given, which conflicts with the `injectedRtkApi`.
For example, I have a graphql query named `ordersByAccountID`, but then the hook generates as `getOrderesByAccountIdQuery`, throwing an error because the D is generated as lowercase, when the API object returns it as a capitalized D.
### Your Example Website or App
https://stackblitz.com/~/github.com/charlieforward9/graphql-codegen-typescript-rtk-query-hook-name-bug
### Steps to Reproduce the Bug or Issue
1. Go to types.ts
2. See comment on bottom line about changing the singular character to fix the problem
Experiment changing the `config.namingConvention`, I was unable to figure it out with this.
### Expected behavior
I expect to either, either:
- [ ] Get a hook that matches the default value of the GraphQL operation
- [ ] Have the ability to modify the hook naming convention with the `config.namingConvention` object.
_I just read that Pascal Case is industry standard, but I do also find it helpful to allow developers to customize to their liking if the config's are already there_
### Screenshots or Videos
This is the problem as it appears in our full scale codebase - many operations are showing as errors due to ending with `ID`
### Platform
- OS: macOS
- NodeJS: 20.0.9
- `graphql` version: 16.8.1
- `@graphql-codegen/cli`: 5.0.2
- `@graphql-codegen/typescript-rtk-query`: ^3.1.1
### Codegen Config File
_No response_
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.