microsoft / microsoft/cppgraphqlgen
Fragments should generate their own structs
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 350
- Forks
- 56
- Avg merge
- 2h 33m
- Merged PRs (30d)
- 3
Description
When generating a client using fragments and lots of similar queries that use the same fragment it leads to lots of the same structs being generated.
Ideally there would be a seperate Fragments struct that contains the defined fragments.
I.e the following queries would both share the same response structs as they use the same fragment:
fragment LoadInfo on Load {
loadId
jobContainerId
name
loadPlanStatus
journey {
journeyId
}
}
query loadById($load: Int!) {
loadByID(loadId: $load) {
...LoadInfo
}
}
query loadBySupplier($supplier: String!, $after: LocalDateTime!) {
loadsBySupplierId(supplierCode: $supplier, after: $after) {
...LoadInfo
}
}
Not sure how feasible that is, but I think something similar is done for input types and enums?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by tracing the generator’s existing handling of input types and enums, then define how fragment-owned structs are emitted and reused; done means both sample queries share the fragment response structs without duplicate definitions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, graphql
- Domain
- backend-api-design, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100