DX: Inconsistent casing of "ID" in generated graphql queries
Before opening, please confirm:
- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
How did you install the Amplify CLI?
No response
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
7.6.5
What operating system are you using?
Windows
Amplify Categories
api
Amplify Commands
codegen
Describe the bug
I've been trying to keep everything standardised when it comes to the capitalisation of my "ID" fields. I've used the same format that is used in the schema through out yet it seems that some of the auto generated queries for graphql aren't sticking to that consistently.
Here I have my schema which has a @key with a queryField of "visitsByAreaIDAndStatus":

Note that "ID" matches that uses for the ID Type too.
Now in my generated queries we have this:

The variable name for this query is "visitsByAreaIdAndStatus" yet the query itself uses the correct casing. This leads to me having to keep looking it up in AppSync console to make sure I'm using the right casing. Its a seemingly small thing but it messed up my flow enough today to want to make this issue for it :)
Expected behavior
I'm guessing there is a titleCase method that the queries are using to make them standardised, could this not be tweaked or give us an opt in to have some over-rides or exceptions? Ideally I like it to match the casing used schema which is provided to it via the queryField, could it not just use that if provided?
Reproduction steps
Create a schema, give one of your models a key with a queryField of "myTypeByID", generate it, check the generated queries in src\graphql\queries.ts
GraphQL schema(s)
# Put schemas below this line
Log output
# Put your logs below this line
Additional information
No response
@Straubulous can you please transfer this to the codegen repo. I believe any fix would need to happen there.
Thank you for raising this issue. I've tagged as an enhancement request, and will work with the team to slot into our backlog.
This needs to be reproduced with V2 directives if the issue still exists.