ChilliCream / ChilliCream/graphql-platform
Add mechanism to exclude specific Type classes from auto-discovery
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.8k
- Forks
- 810
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 98
Description
Product
Hot Chocolate
Is your feature request related to a problem?
I need to prevent a ScalarType class from being auto-discovered and registered by HotChocolate.Types.Analyzers because it's designed to be instantiated dynamically by a TypeInterceptor, not registered automatically.
Context
- Working with
HotChocolate.Types.Analyzers - Modeling a generic type
Id<T>in GraphQL schema - Have a class
IdTypedScalar : ScalarTypethat should be created dynamically by aTypeInterceptorfor each concrete type (e.g.,Id<User>,Id<Product>, etc.) - The analyzers are auto-discovering it and generating
builder.AddType<IdTypedScalar>()which fails because it requires constructor parameters (the generic type argument) - This class should only be instantiated by my interceptor, not registered automatically
What I've Tried
- Making it
internal/private- still gets discovered - Using
[GraphQLIgnore]- annotation cannot target a class
Question
Is there a way to exclude specific classes that inherit from ScalarType from being auto-discovered by HotChocolate.Types.Analyzers? Looking for:
- An attribute to mark the class as non-discoverable
- Configuration options to exclude specific types
- Any other mechanism to prevent auto-registration
The solution you'd like
The IdTypedScalar class should be excluded from auto-discovery so that:
- It doesn't generate
builder.AddType<IdTypedScalar>()calls - It can still be instantiated by my
TypeInterceptor(e.g.,new IdTypedScalar(typeof(User)))
Contributor guide
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
Start by locating the HotChocolate.Types.Analyzers auto-discovery logic and the generation of builder.AddType() calls described in the issue. Done means a specific ScalarType can be excluded from generated registration while remaining available for instantiation by a TypeInterceptor; no files or tests are named in the payload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100