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

[feature-request] Generate compliant schema to use with traditional GraphQL tooling #76

Open
rhlsthrm opened this issue Jul 7, 2021 · 3 comments

Comments

@rhlsthrm
Copy link

rhlsthrm commented Jul 7, 2021

I am using GraphQL Code Generator to generate a Typescript typed client. This works great if I point my codegen schema file at the deployed subgraph, i.e.

schema: https://api.thegraph.com/subgraphs/name/connext/nxtp-goerli

However if I try to point at a local schema, i.e.

schema: ./schema.graphql

I get an error about types:

Failed to load schema from ../subgraph/schema.graphql:

        Unknown type: "BigInt".
        Error: Unknown type: "BigInt"

Some helpful people on Discord informed me that the schema that Graph uses is non-compliant and therefore shouldn't be treated as such. However, with the wealth of tooling for GraphQL, it would be really nice to get the generated schema that is compliant.

@schmidsi
Copy link

schmidsi commented Jul 7, 2021

Thanks for the write-up: The current problem is that we use schema.graphql as our database schema definition. The actual generated schema that clients query is not saved during development process. I see two milestones to solve this problems:

  1. Low hanging fruit: Make yarn build also output the generated schema so we can reuse it for tooling like that
  2. Longterm: Refactor the database schema definition into its own DSL like Prisma Schema. Although this needs more discussion.

Somewhat related: #77

@rhlsthrm
Copy link
Author

rhlsthrm commented Jul 7, 2021

Low hanging fruit: Make yarn build also output the generated schema so we can reuse it for tooling like that

This would fit my needs perfectly!

@llllvvuu
Copy link

llllvvuu commented Jun 11, 2023

We need also the query root type. I would like to work on this if possible. What files should be looked at?

EDIT: In terms of a workaround, I found the get-graphql-schema CLI tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants