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] Report invalid schema during build before deploy #1364

Open
1 of 2 tasks
sebastiantf opened this issue May 29, 2023 · 4 comments
Open
1 of 2 tasks

[Feature] Report invalid schema during build before deploy #1364

sebastiantf opened this issue May 29, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@sebastiantf
Copy link

Description

It seems graph-node does not fully support all features of GraphQL schema definition. And defining a schema that's not supported tends to be reported only during the final deploy step instead of build step, which could be misleading and confusing during development.

It would really helpful and saves time if unsupported or invalid schema is reported early during build steps instead of deploy

Are you aware of any blockers that must be resolved before implementing this feature? If so, which? Link to any relevant GitHub issues.

No response

Some information to help us out

  • Tick this box if you plan on implementing this feature yourself.
  • I have searched the issue tracker to make sure this issue is not a duplicate.
@sebastiantf sebastiantf added the enhancement New feature or request label May 29, 2023
@saihaj
Copy link
Member

saihaj commented May 30, 2023

can you give an example @sebastiantf?

@sebastiantf
Copy link
Author

interface Campaign {
  id: Bytes!
  # ... other fields
}

type ERC20Campaign implements Campaign @entity {
  # Campaign:
  id: Bytes!
  # ... other fields

  claims: [ERC20Claim!]! @derivedFrom(field: "campaign")
}

interface Claim {
  id: Bytes!
  # ... other fields

  campaign: Campaign!
}

type ERC20Claim implements Claim @entity(immutable: true) {
  id: Bytes!
  # ... other fields

  # Extra fields:
  campaign: ERC20Campaign! # union types doesn't seem supported yet
}

This is an excerpt from what i've been working on. Not exactly sure if this is an invalid GraphQL issue, or graph-node issue tbh. But nevertheless, graph build would be successful without reporting any issues. When doing graph deploy, after completing all the preliminary steps, in the end it fails with the error:

✖ Failed to deploy to Graph node https://api.thegraph.com/deploy/: deployment failure::subgraph resolve error: resolve error: Entity type `ERC20Claim` does not satisfy interface `Claim` because it is missing the following fields: campaign: Campaign!

It would be nice if this could be known at the build step before deploy

@incrypto32
Copy link
Member

@saihaj what do you think ? Is there a way to validate the schema to make sure its supported by graph-node during the build? Although the provided example is valid GraphQL graph-node doesn't support it, is what i understand (?)

@saihaj
Copy link
Member

saihaj commented Jun 5, 2023

Is there a way to validate the schema to make sure its supported by graph-node during the build?

Yeah I think there are some things we can do in graph-cli. I think if we can have meta.graphql in CLI. Based on example this there is probably missing implementing all the fields for the interface and in GraphQL you must redefine all the fields if you are implementing an interface. So we can compose a Schema and then try to get these errors on build time. cc @dotansimha if you have any other ideas on this one

@saihaj saihaj transferred this issue from graphprotocol/graph-node Jun 5, 2023
@saihaj saihaj added this to Tooling Jun 5, 2023
@saihaj saihaj moved this to 🆕 New in Tooling Jun 5, 2023
@theguild-bot theguild-bot mentioned this issue Oct 31, 2023
26 tasks
This was referenced Apr 30, 2024
This was referenced May 7, 2024
@theguild-bot theguild-bot mentioned this issue Oct 15, 2024
26 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🔖 Next
Development

No branches or pull requests

4 participants