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

Any .graghql file that contains a fragment all queries in the same file must utilize it for "Execute Query" to work #2350

Open
CormacLennon opened this issue Mar 30, 2022 · 0 comments

Comments

@CormacLennon
Copy link

Actual Behavior

image

See screenshot, GetOrders Query correctly runs, GetOrderIds fails with the error seen to the right


{
  "errors": [
    {
      "message": "The specified fragment `OrderFragment` is not used within the current document.",
      "extensions": {
        "fragment": "OrderFragment",
        "specifiedBy": "http://spec.graphql.org/June2018/#sec-Fragments-Must-Be-Used"
      }
    }
  ]
}

The fragment is being used by the Query GetOrders

Expected Behavior

GetOrderIds correctly runs

Steps to Reproduce the Problem Or Description

Create .graphql file and add a fragment and two queries which run against the same api endpoint, one utilises the fragment one does not.

Specifications

  • GraphQL for VSCode Extension Version: 0.3.35
  • VSCode Version: 1.64.0
  • OS Name: Windows 10
  • OS Version: 20H2
  • graphql config filename and format example:

schema: http://localhost:5254/graphql?sdl
documents: "src/**/*.{graphql,js,ts,jsx,tsx}"
extensions: {
languageService: {
cacheSchemaFileForLookup: true
},
endpoints: {
default: {
url: " http://localhost:5254/graphql",
},
},
}

Logs Of TS Server || GraphQL Language Service

NetworkHelper: operation: query
NetworkHelper: endpoint: http://localhost:5254/graphql

@acao acao transferred this issue from graphql/vscode-graphql Apr 19, 2022
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

2 participants