graphql / graphql/graphiql

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

Open
#2,350 0 comments 0 reactions 0 assignees View on GitHub
vscode-graphql
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

## Actual Behavior
![image](https://user-images.githubusercontent.com/62661794/160803601-df0f3ed2-9357-4ecc-8d33-a87d61c58e50.png)

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.