graphql-code-generator icon indicating copy to clipboard operation
graphql-code-generator copied to clipboard

Reference to source Document

Open FairyTail2000 opened this issue 1 year ago • 1 comments

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

FairyTail2000 avatar Jul 07 '23 09:07 FairyTail2000

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

intellix avatar Dec 09 '23 12:12 intellix