Option to generate type definitions side by side with *.gql files
See original GitHub issueIt would be awesome if there was a option to just generate fragments and services side by side with the *.gql files.
This example
[Component A]
- query.gql
[Component B]
- query.gql
resulted in this output.
[Component A]
- query.gql
- query.ts
[Component B]
- query.gql
- query.ts
Then i could define an angular component’s specific fragments without worrying about naming collisions, like I needed to do here because some other component’s grapql query had a fragment defined with the name location
, and the same goes for query and mutation names.
fragment locationSelect on Location {
id
name
}
query GetPositionModalData {
locations: locationsConnection(pagesize: -1) {
edges {
node {
...locationSelect
}
}
}
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:14
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Generating types from a GraphQL schema
We'll use the GraphQL Code Generator library to generate types based on our GraphQL schema. There are multiple ways to provide a schema...
Read more >Emitting the schema SDL - TypeGraphQL
To accomplish this demand, TypeGraphQL allows you to create a schema definition file in two ways. The first one is to generate it...
Read more >Integrating GraphQL Code Generator in your frontend ...
In this article we'll try to explain and demonstrate common patterns for frontend development with GraphQL and GraphQL Code Generator.
Read more >TypeScript with GraphQL done right - Charly Poly
Contrary to the manually maintained data types, using the GraphQL Code Generator puts the data-types maintenance on the GraphQL API side.
Read more >Using Apollo Client to Manage GraphQL Data in our Next.js ...
When we run either of the above commands, our GraphQL queries and mutations wrapped in gql tags are converted to Typescript and output...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s how I’ve solved this in my codebase: Rather than using the graphql-code-generator CLI with a wildcard for all my documents, I run it using the API, once for each document:
It’s a new project so I have very few documents at the moment, and I haven’t seen how well it scales yet.
@furier @adam1658 @vreality64 @Morphexe It took some time, but it’s available (as alpha) now after this PR: https://github.com/dotansimha/graphql-code-generator/pull/1846