dotansimha / dotansimha/graphql-code-generator-community
[near-operation-file] Option to generate files based on operation name, not component name
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
**Is your feature request related to a problem? Please describe.**
Some tools such as [Apollo Tooling](https://github.com/apollographql/apollo-tooling) generate files based on operation name.
**Describe the solution you'd like**
To make it easier [to migrate from Apollo Tooling to Codegen](https://github.com/apollographql/apollo-tooling/issues/2053), we could have an option to generate file name based on operation names.
## Examples
```
// GraphQL Codegen detects gql in a React component:
------- ReactComponent.ts
...
const GET_FOO_QUERY = gql`
query GetFoo($id: String) {
...
}
`;
...
=========
// BEFORE: the generated filename is always based on the React component's filename:
------- ./__generated__/ReactComponent.ts
...
export type GetFooVariables = ...
export type GetFoo = ...
...
========
// AFTER: add a configuration option so the generated filename is based on the operation name (Query, Mutation, or Fragment):
------- ./__generated__/GetFoo.ts
...
export type GetFooVariables = ...
export type GetFoo = ...
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.