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.

Exclude package from codegen

See original GitHub issue

Hi,

I’d like to be able to exclude a package from codegen. Currently, I have a project that also uses shopify api for the shop pages. However, codegen crashes because the schema is different from prisma’s schema.

I don’t want to build a full-fledged ecommerce functionality into my app, and would prefer to use shopify api for the few products the app offers. And use urql/react-query to access only on the shop/cart/checkout page. I can confirm using urql or react-query or swr works for my use case. But codegen crashes.

I’ve tried overwriting the documents field in the graphql.config.js file to only include documents from /web and /api, as I have all the schema/gql for shopify in /packages/shop. And I intentionally don’t want to merge schemas or redefine queries/mutations/resolver for shopify

But this does not work, as it ignores the document field and still manages to find the shop queries and mutations in /packages/shop and crashes.

I codegen for shopify as well, and can confirm it works, as I only include documents in the /packages/shop and point my codegen script to call a local config in /packages/shop. But updating the documents fields in the root graphql.config.js does not work and does not successfully exclude /packages/shop.

Does rw/types actually read the local graphql.config.js? If yes, can we provide a way to overwrite it or extend as you would say webpack.config? Or can we call rw types with a custom config file and provide guidance on extending default config.

I know graphql config also recently added the concept of projects. So that might be another approach to isolating the config for @graphql/codegen.

Thank you.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
thedavidpricecommented, Oct 26, 2021

Thanks for the update! And definitely curious to learn more about what you’re building — if/when you’re up for it, we ❤️ posts in the Forum Show & Tell. (And/or I’d welcome a DM anytime.)

As for schema stitching, looping in @dthyresson and @urigo --> This seems like a possible case for GraphQL Mesh (or a subset of tools). I’m just not sure about the integration points with Redwood. But it would be rad to figure it out!

1reaction
dthyressoncommented, Oct 26, 2021

Thanks for the update! And definitely curious to learn more about what you’re building — if/when you’re up for it, we ❤️ posts in the Forum Show & Tell. (And/or I’d welcome a DM anytime.)

As for schema stitching, looping in @dthyresson and @Urigo --> This seems like a possible case for GraphQL Mesh (or a subset of tools). I’m just not sure about the integration points with Redwood. But it would be rad to figure it out!

I tried Mesh maybe a year or so ago but not recently.

@thedavidprice in our experiment list (can we start one?) I’d add this together with the Redis cache and live query GraphQL investigations id line to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

schema ! -exclude rules are not respected #2649 - GitHub
Failed to load schema from !packages/server/src/schema/index.ts: Unable to find any GraphQL type definitions for the following pointers: ...
Read more >
Includes and Excludes - jOOQ
Packages ; Queues; Routines; Sequences; Tables; UDTs. Excludes match before includes, meaning that something that has been excluded cannot be included again.
Read more >
cxf-codegen-plugin to exclude XSD files - Stack Overflow
What I am asking is - have you tried building the project with Maven in CLI on the developer machine? In exactly the...
Read more >
codegen - dbt - Package hub
Macros that generate dbt code, and log it to the command line. Contents. dbt-codegen; Contents; Installation instructions; Macros. generate_source (source).
Read more >
Swagger Codegen Documentation
The Swagger Codegen is an open source code-generator to build server stubs and client SDKs directly from a Swagger defined RESTful API. The...
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