graphql / graphql/graphiql

Multi-project config file not working for schema introspection

Open
#2,293 16 comments 6 reactions 0 assignees View on GitHub
bug lsp-server
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

I want to use multiple GraphQL endpoint on single project, but this extension seems load only one (first) project even if multiple project exists on `graphql.config.yml`.

Here's example, only 3 files on directory.
Open the directory with VSCode that installed this extension.

**graphql.config.yml**
```yml
projects:
rickandmortyapi:
schema: https://rickandmortyapi.com/graphql
spaceX:
schema: https://api.spacex.land/graphql/
```

**spacex.graphql**
```graphql
query getUsers {
users {
id
name
}
}

query getDragons {
dragons {
id
name
}
}
```

**rickandmorty.graphql**
```graphql
query getCaracters {
characters {
results {
name
}
}
}

query getLocations {
locations {
results {
name
}
}
}
```

In above case, `rickandmorty.graphql` is perfectly validated and auto completed but `spacex.graphql` throws validation error.

> Cannot query field "users" on type "Query"

Yes, I know it is difficult to find proper project for each `.graphql` file automatically. So is there any way to assign specific project to each `.graphql` file? Can I find some reference about this anywhere?

If there's no way so far, I want feature like this.

**spacex.graphql**
```graphql
#[[spaceX]]
query getUsers {
users {
id
name
}
}

query getDragons {
dragons {
id
name
}
}
```

**rickandmorty.graphql**
```graphql
#[[rickandmortyapi]]
query getCaracters {
characters {
results {
name
}
}
}

query getLocations {
locations {
results {
name
}
}
}
```

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.