-
Notifications
You must be signed in to change notification settings - Fork 63
Do we fully support fragments? #29
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
Comments
This seems a bug in the angular service generation. The fragment definition is missing in the generated API queries. It works if I manually edit the generated service and add the missing fragment after the query. |
@brunostuani Currently Amplify Codegen does not support fragments. Marking this as an enhancement. |
As my GraphQL schema is getting bigger, I was looking for a similar solution and just discovered fragments. Is there a way to make it work by bypassing the codegen part, or are fragments simply not usable on Amplify ? |
I have been using a hacky implementation for some time now and finally managed to assemble it as a plugin https://github.com/artemkloko/amplify-graphql-fragments-generator It supports only TypeScript and is not for production. Still would be nice if someone could test it on a playground project or comment on the strategy itself. |
@artemkloko I'm really liking the look of that library! I have also created your first issue! (sorry!) - artemkloko/amplify-graphql-fragments-generator#1 let me know if you need any help with the issue 👍 |
I found a different way of doing this myself. I'm leaving it here for anyone that wants to use it as well. So far, it's been working for us, and it preserves the types we expect to see, with minimal effort and minimal verbosity. It takes care of the the SERVER-SIDE problem of only asking for what you need, rather than having to ask for everything all the time ...which matters. A lot, in fact. 😎 We're doing this in a Nuxt3 SSR project, so there's a heck of a lot of bells and whistles. Ingredient 1: A Function that consumes a
|
Hey @brunostuani 👋, Apologies for the significant delay in responding. The issue has been resolved in the latest Amplify CLI version. Please test it with the latest CLI and let us know if there are any other issues. |
** Which Category is your question related to? **
GraphQL transformer codegen
** Provide additional details e.g. code snippets **
I'm adding a fragment in a custom GraphQL query file. For example:
Codegen gracefully generates SheetPartsFragment into my API, but when requesting the qery through the generated API, I get this error:
core.js:15724 ERROR Error: Uncaught (in promise): Object: {"data":null,"errors":[{"path":null,"locations":[{"line":9,"column":9,"sourceName":null}],"message":"Validation error of type UndefinedFragment: Undefined fragment SheetParts @ 'getList/sheets/items'"}]}
Am I missing something?
Thanks
The text was updated successfully, but these errors were encountered: