Reputation: 6239
I'm trying to configure VSCode GraphQL extension, but its info is some obscure for me.
I have this basic Flutter project structure:
.
├── analysis_options.yaml
├── android
├── assets
├── lib
│ ├── graphql
│ │ └── *.gql
│ ├── main.dart
│ ├── private
│ │ └── graphql.config.json
│ └── shared
├── pubspec.lock
├── pubspec.yaml
├── README.md
├── test
└── tutorial_with_hasura_server.iml
I've created graphql.config.json
into ./lib/private
directory with this setting:
{
"schema": {
"request": {
"url": "https://hasura.io/learn/graphql",
"method": "POST",
"postIntrospectionQuery": true,
"options": {
"headers": {
"Authorization": "Bearer 1234567890123456789"
}
}
}
}
}
Meanwhile in VSCode settings.json
I've added this line:
"graphql-config.load.filePath": "./lib/private/graphql.config.json",
I'm trying to run a simple GraphQL query operation which is stored in a file with extension GQL located in ./lib/graphql
directory, but no result, no error message, nothing at all. What am I missing?
Upvotes: 1
Views: 4678
Reputation: 126
Try placing the following in a graphql.config.json
file at your project root. The name of the project should be the path to the directory that contains your graphql folder. For OP, that would be lib
:
{
"projects": {
"lib": {
"extensions": {
"endpoints": {
"default": {
"url": "https://hasura.io/learn/graphql",
"headers": {
"Authorization": "Bearer 1234567890123456789"
}
}
}
}
}
}
}
Upvotes: 2