-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codegen does not produce compilable typescript queries.ts code #1960
Comments
Hey @hisham, Thank you for bringing this matter to our attention. Following the instructions outlined in the issue, we observed that amplify codegen is not generating the code for custom queries as expected. Therefore, we're categorizing this as a bug for the team to conduct further investigation. Here's a snippet of the schema and .graphqlconfig.yml used: Schema:
.graphqlconfig.yml:
Upon running amplify codegen, the expected code generation did not occur. |
looks like this has been fixed in the latest release btw. |
This is still happening on a mac on release 12.13.0 |
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
18.16.1
Amplify CLI Version
12.7.0
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
After running
amplify codgen
to produce typescript code for a graphql API, the queries.ts file does not compile if the GraphQL API has a query function with no parameters.Specifically the queries.ts code will have code like so that has a ts error:
The error is
'./graphql-schema' has no exported member APITypes.GetProductsQueryVariables
If you check the graphql-schema.ts file, you'll see there is no APITypes.GetProductsQueryVariables type defined. I assume because this function has no parameters and therefore there are no input variables to define.
Expected behavior
amplify codegen should produce syntactically correct queries.ts file.
Reproduction steps
.graphqlconfig.yml
file to produce typescript graphql schema code like so:amplify codegen
and examine the resulting queries.ts fileProject Identifier
3def1a2bd59d61900f734d59f169a578
Log output
Additional information
No response
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: