Auto complete and validation for multiple projects.
See original GitHub issueI 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
projects:
rickandmortyapi:
schema: https://rickandmortyapi.com/graphql
spaceX:
schema: https://api.spacex.land/graphql/
spacex.graphql
query getUsers {
users {
id
name
}
}
query getDragons {
dragons {
id
name
}
}
rickandmorty.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
#[[spaceX]]
query getUsers {
users {
id
name
}
}
query getDragons {
dragons {
id
name
}
}
rickandmorty.graphql
#[[rickandmortyapi]]
query getCaracters {
characters {
results {
name
}
}
}
query getLocations {
locations {
results {
name
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:11 (7 by maintainers)
Top GitHub Comments
I don’t think this will solve the multi-project config issue. This known issue is on our roadmap, it will take us a while since we‘re all volunteers
@Chnapy so users would need to annotate every single template literal for it to work? or change the name of every query. I don’t think this approach is sustainable, though I’m glad it worked for your team. We cannot implement strict conventions like these, as this extension is used by people using all kinds of projects, frameworks and conventions. We’re a reference implementation, besides, so it’s not up to us to set any conventions outside of the spec.
We will remain with using graphql config to define project configurations, we just need to fix the multi-project cache and make it work with workspaces. Hopefully someone has time to pick it up, work has been busy so it may be some more months until I can get to this, but I think about it all the time don’t worry haha
If folks want a multi-project LSP server and vscode extension that works now, and you’re using relay, try the relay extension! it’s really incredibly and it works with multi projects (called environments in relay) and multi-workspaces.