Open addiebarron opened 2 months ago
I noticed this is technically possible, as certain tools do integrate with documents
this way (vscode's graphql lsp-server supports this albeit in a limited/buggy capacity). It would be great to have the behavior formalized and added to the docs! I'd be willing to make that docs PR but I don't know enough about the library's behavior to describe it accurately.
Is your feature request related to a problem? Please describe.
I work on a project that defines its GraphQL schema in
gql
tags across a number of.ts
files in the server directory. We generate aschema.graphql
file from those code files in the pre-commit step using graphql-codegen, but during development the most up-to-date information about the schema is in thosegql
tags, not in theschema.graphql
file.Furthermore, in my IDE, clicking through any client-side definitions (e.g. a query name in a query operation) sends me to the generated schema rather than the typescript source, which is what we'd consider the "source of truth". (I recognize this could also be implemented as an IDE feature. I'll make a ticket there as well).
Describe the solution you'd like
Graphql config files should support
js
/ts
files in theschema
field. Consumers can parse the graphql from those files as they choose.Describe alternatives you've considered
The only working alternative now is to search the codebase for the definitions as they appear in Typescript.
Additional context
Some kind of "source map" concept could potentially solve this as well. I wish I could integrate directly with
graphql-codegen
!