ChilliCream / ChilliCream/graphql-platform

Option to generate separate types that are reused

Open
#5,572 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Is your feature request related to a problem?

I'm currently using StrawberryShake to retrieve data from a GraphQL endpoint, than map it to another object model, serialize it to XML to provide it to another service.

The object model and the query response contain quite a few types that are reused on several levels in the object model.
But StrawBerryShake generated the type names in a hierarchical way. Like IMyQueryName_RootObject_ChildObject.
This makes IMyQueryName_RootObject_ChildObject and IMyQueryName_RootObject_OtherNode_ChildObject two different types, although they are the same.

This causes my mapping to require more duplicate methods that only differ in incoming type name.

The solution you'd like

I know this hierarchical way of generating type names is safer to prevent type clashes.

That's why I would like to see the option to generate types in a way that types with the same name are considered the same.
So they are reused in the generated client code.

So I have an easier time mapping.

Product

Strawberry Shake

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating Strawberry Shake's generated-client type naming and reuse logic, then determine how an opt-in same-name policy should handle type clashes; done means reused types are generated where names match without unsafe collisions.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, graphql
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.