The Wayback Machine - https://web.archive.org/web/20210907033145/https://github.com/cli/cli/pull/3689
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

Testing: validate our GraphQL queries against GHES schema #3689

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

@mislav
Copy link
Member

@mislav mislav commented May 21, 2021

To ensure we don't generate GraphQL queries that aren't compatible with an older version of the GitHub API (GHES), we'd like to come up with a mechanism to validate each GraphQL query that we generate in tests against a GraphQL schema.

WIP:

$ make ghes-2.21.graphql
$ go run ./cmd/gql-validate ghes-2.21.graphql '{viewer}'
query error: input:1: Field "viewer" of type "User!" must have a selection of subfields. Did you mean "viewer { ... }"?

exit status 1

TODO:

  • Hook into our test suite (probably httpmock.GraphQL calls) and verify each GraphQL query against the schema of the oldest supported Enterprise version
  • Figure out how to handle queries that we dynamically generate based on schema instrospection

Ref. #3688 #2996 #2035

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

Successfully merging this pull request may close these issues.

None yet

1 participant