-
-
Notifications
You must be signed in to change notification settings - Fork 798
Open
Labels
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 : ScalarType
that should be created dynamically by aTypeInterceptor
for 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))
)