question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incremental adaptation of graphql-let

See original GitHub issue

Hi there!

Hope I’m putting this question in the correct place, if not please let me know.

I just found this library yesterday and I’m pretty excited about the features it could provide our codebase. Right now we are using next.js with around 100+ queries and mutations which are spread around different services that are schema stitched into a single schema.

Doing a full migration into graphql-let is no easy take-on so I would love to be able to do a query-by-query adaptation into our codebase. Is that possible they way the library is setup right now?

I tried use the document option to generate types for a single graphql query but I always got a huge file(10k + lines) with the entire schema, perhaps I’m doing something wrong here. What I expected to happen is that the types needed for that particular query would be generated and nothing else.

I would be super happy, if anyone can nudge me in the right direction.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
piglovesyoucommented, May 12, 2021

Thank you for your quick reply. I see, I understood it in wrong way. You’d like per-document types output, which only contains schema types the document depends on. The v0.18.0 doesn’t cover that, it only commonizes schema types (green part). That sounds tree-shaking, which I don’t think even GraphQL code generator supports still.

Personally, I think developers would need to use schema types that document doesn’t depend on sooner or later. If so, having the whole schema types somewhere is not bad idea since we can’t know which types are in use in the future. (v0.18.0 will provide the way to access the schema types.)

Good thing is, the schema types file (__SCHEMA__.d.ts in above) is cached, which is skipped in the next generation process if GraphQL schema is same. The speed you experience must be tolerable after the first generation.

I’ll leave this issue open (maybe for time GraphQL code generator supports tree-shaking in the future). I’m glad if you try v0.18.0 and judge if it meets when you have time.

1reaction
Siggnjacommented, Apr 1, 2021

@piglovesyou Any news on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incremental Rewrites with GraphQL - Khan Academy Blog
GraphQL gateways generate a query plan to build up a response that includes data from multiple backend services.
Read more >
graphql-let - A Webpack loader for GraphQL Code Generator
graphql-let is a wrapper tool that makes using GraphQL Code Generator smoother and easier. In this article, I'll explain what graphql-let is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found