You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered:
charlieforward9
changed the title
[RTK-Query] InjectedAPI does not properly name hooks
[RTK-Query] Hook generator does match InjectedAPI typings
May 7, 2024
I was able to work around this by changing my schema to conform to pascalCase. However, I believe this is a limitation of the parser that should be AT LEAST mentioned as a limitation.
charlieforward9
changed the title
[RTK-Query] Hook generator does match InjectedAPI typings
[RTK-Query] Hook generator does not match InjectedAPI typings
May 7, 2024
charlieforward9
changed the title
[RTK-Query] Hook generator does not match InjectedAPI typings
[RTK-Query] Hook generator does not match InjectedAPI typings when typings are not in pascalCase
May 7, 2024
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 asgetOrderesByAccountIdQuery
, 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
Experiment changing the
config.namingConvention
, I was unable to figure it out with this.Expected behavior
I expect to either, either:
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
graphql
version: 16.8.1@graphql-codegen/cli
: 5.0.2@graphql-codegen/typescript-rtk-query
: ^3.1.1Codegen Config File
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: