Skip to content
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

Unable to generate operations.graphql #838

Closed
4 tasks done
charlieforward9 opened this issue May 7, 2024 · 5 comments
Closed
4 tasks done

Unable to generate operations.graphql #838

charlieforward9 opened this issue May 7, 2024 · 5 comments
Labels
question Further information is requested

Comments

@charlieforward9
Copy link

charlieforward9 commented May 7, 2024

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • 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?

npm

If applicable, what version of Node.js are you using?

20.9.0

Amplify CLI Version

12.11.1

What operating system are you using?

Mac

Amplify Codegen Command

other codegen <subcommand> (please mention in the issue)

Describe the bug

I would like to efficiently generate RTK Query hooks for my Amplify application using this tool.

I have not been able to figure out how to generate the code that belongs in the operations.graphql input. In other word, the files that are generated with amplify codegen statements but without the Typescript wrapped around.

Screenshot 2024-05-06 at 11 20 39 PM

Maybe I am missing a simple command, but if not it would be really helpful to have this as a codegen statement...

Expected behavior

Screenshot 2024-05-06 at 11 56 26 PM

The output I expect is the useGetAccountQuery, but properly typed with the queries definition found in graphql/queries.ts, but without the typescript wrapping it.

Screenshot 2024-05-06 at 11 25 31 PM

I would like to have an option to access these statements in their graphql syntax within my codebase via this codegen package.

Reproduction steps

  1. Install this lib
  2. Try to get a single graphql file with all of the operations the schema offers.
@charlieforward9 charlieforward9 changed the title How to generate operations.graphql with this package? Unable to generate operations.graphql May 7, 2024
@dpilch
Copy link
Member

dpilch commented May 7, 2024

Changing your codeGenTarget to graphql in .graphqlconfig.yml will generate the GraphQL statements in raw GraphQL syntax.

projects:
  Codegen Project:
    extensions:
      amplify:
        codeGenTarget: graphql

@dpilch dpilch added the question Further information is requested label May 7, 2024
@charlieforward9
Copy link
Author

Thank you - this solved my problem.

This would be nice to have as a CLI config, or specified somewhere in docs.

Maybe I missed it. Thank you.

@dpilch dpilch closed this as completed May 7, 2024
Copy link

github-actions bot commented May 7, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

@charlieforward9
Copy link
Author

@dpilch Is there a plan to support this with amplify mock api?

@dpilch
Copy link
Member

dpilch commented May 10, 2024

That is not prioritized at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants