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 a TypeInterceptor 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)))
Product
Hot Chocolate
Is your feature request related to a problem?
I need to prevent a
ScalarTypeclass from being auto-discovered and registered byHotChocolate.Types.Analyzersbecause it's designed to be instantiated dynamically by aTypeInterceptor, not registered automatically.Context
HotChocolate.Types.AnalyzersId<T>in GraphQL schemaIdTypedScalar : ScalarTypethat should be created dynamically by aTypeInterceptorfor each concrete type (e.g.,Id<User>,Id<Product>, etc.)builder.AddType<IdTypedScalar>()which fails because it requires constructor parameters (the generic type argument)What I've Tried
internal/private- still gets discovered[GraphQLIgnore]- annotation cannot target a classQuestion
Is there a way to exclude specific classes that inherit from
ScalarTypefrom being auto-discovered byHotChocolate.Types.Analyzers? Looking for:The solution you'd like
The
IdTypedScalarclass should be excluded from auto-discovery so that:builder.AddType<IdTypedScalar>()callsTypeInterceptor(e.g.,new IdTypedScalar(typeof(User)))