-
Notifications
You must be signed in to change notification settings - Fork 470
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
Seeking Codegen feedback #2614
Comments
I just used https://www.graphql-code-generator.com/ lots of configuration options and really easy to use. I really enjoyed it. |
Also related: #2053 :) |
@dotansimha thanks for that fantastic writeup, I'm sorry we never went forward with any of the suggestions you laid out. It certainly wasn't for a lack of effort on your part - as I'm sure you can tell this repo has gone unloved for some time now. 2 years ago, the idea of wrapping I'm going to leave #2053 open for now since there's a lot of great information there for people looking to migrate, in hopes that it's slightly more discoverable open instead of closed. You're more than welcome to close it if you choose, I'll probably close whenever I finally get to cut the last major for these packages. |
I considered switching to graphql-code-generator but I stayed with Apollo's version because it generates intermediate types, which I use extensively. The solution proposed in #2053 (comment) is to use Fragments, which makes sense if the Fragment is used multiple times, but often I want to use the intermediate type(s) on regular Queries with no Fragments. Having to insert Fragments into my Query just to get the intermediate types to generate is not ideal, it makes the Query more complex, and I have to name the Fragment. |
@markhalonen can you share your use-case for accessing indermediate types? We did this in codegen V1, but decided to drop it as it bloated auto-complete suggestions and code output with named types. As an alternative you can use lookup types. |
hi @markhalonen ! As @n1ru4l said, we had the in older versions of codegen, but we decided to drop it (~4y ago. there's still The main reason was the complexity of the generated output and the fact that it led to many conflicts and unused types. |
For example I'd import a type such as import {
PartNumberProcessQuery_partNumberById_processNodeByDefaultProcessNodeId_descendantRelationships_processNodeByFromId as ProcessNodeWithDetails,
} from '../generated' and then parse a tree into an ordered flat list of these Nodes, and then pass that flat list to a child component.
Ah, I looked that up. I've never used lookup types before. Wow, TypeScript is powerful! That would be a solution for intermediate types. Well, especially with the Apollo maintainers advocating for graphql-code-generator it seems a migration is in my future... Thanks for the tips guys! |
I'd like to remove codegen completely in an upcoming major release of the CLI. For awhile,
graphql-code-generator
has been a superior tool which offers compatibility with all of Apollo's tools. We highly recommend migrating to it.For anyone who is still using Apollo's codegen feature, is there anything in particular that's prevented you from making the switch?
The text was updated successfully, but these errors were encountered: