dotansimha / graphql-code-generator

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
https://the-guild.dev/graphql/codegen/
MIT License
10.78k stars 1.32k forks source link

Reference to source Document #9534

Open FairyTail2000 opened 1 year ago

FairyTail2000 commented 1 year ago

Is your feature request related to a problem? Please describe.

We have a ton of queries in our project.

Now we have the problem of locating the source file. For example we have multiple different GetReservation Queries serving different purposes. The Problem is to get from the generated typescript file to the source .graphql file

Describe the solution you'd like

A solution would be generate a jsdoc @link above the generated output. Example:

/**
{@link src/graphql_source/reservations/single.graphql}
*/
const getReservationDocument = {};

This would be supported on all major IDEs (Eclipse, Jetbrains, VS Code). The same can also be used for types:

/**
{@link src/graphql_source/reservations/single.graphql}
*/
interface GetReservationResultType {
  typename: string
  id: string
}

Describe alternatives you've considered

Alternative:

Just write the file name into a comment above the generated definition so you can copy it and let the editor open it with the tools provided by the editor (ex. shift shift for Jetbrains IDEs)

Is your feature request related to a problem? Please describe.

No response

intellix commented 9 months ago

yep, this is also killing me. We have hundreds of queries and I'm struggling to find where things are actually generated .from. I think they follow a typical naming convention but I'm losing my mind cause that aint working.

Edit: figured it out, my search was ignoring .graphql files :o but it would have helped me realise quicker with the source file comments