dotansimha / dotansimha/graphql-code-generator

Add the type's GQL comment to the typescript-operations plugin output

Open
#10,316 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

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

I would like for my generated operation types to provides details about what each property is for, like this:

Type definition:
```gql
type MyType {
"Awesome field value"
myField: String!
}

extend type Query {
myType: MyType!
}
```

Operation:
```gql
query MyOperation {
myType {
myField
}
}
```

Generated types:
```ts
export type MyOperationQuery = {
readonly MyType {
/**
* Awesome field value
*/
readonly myField: string;
}
}
```

### Describe the solution you'd like

This could be the default, or enabled with an option on the `typescript-operations` plugin.

From what I could gather, this would probably be done in https://github.com/dotansimha/graphql-code-generator/blob/master/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts, but the schema comments are not available in there.

### Describe alternatives you've considered

_No response_

### Any additional important details?

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.