Closed DaveRMaltby closed 2 years ago
I've mistakenly created this issue in this repo instead of the main repository. I'll copy it over there and close this one.
Created issue in the main repository. https://github.com/ChilliCream/hotchocolate/issues/4867
If
ObjectTypeExtension.Configure()
is overridden or if anAction<IObjectTypeDescriptor>
is provided to the ObjectTypeExtension ctor, neither is ever called. For example, in my dynamic schema, I am adding anObjectFieldDefinition
to my query. But in order to provide this to theITypeModule.CreateTypesAsync
, it must be added to theObjectTypeDefinition.Fields
query extension and converted into aObjectTypeExtension
like so:This was all working fine until I wanted to add paging, sorting and filtering to my dynamically added schema field queries. After much pouring through the Hot Chocolate code, I have ultimately determined that I should be able to inject these facilities, by deriving a class off of
ObjectTypeExtension
like so: (The important call below is thefieldDescriptor.UseSorting()
):and then call the
CreateUnsafe
static method on this derived class as the type extension to return forITypeModule.CreateTypesAsync()
.Unfortunately, in my testing the overridden
ObjectTypeExtensionEx.Configure()
never gets called.Maybe this approach wasn't intended to be supported though. If not, is there another way that dynamic schemas can utilize Hot Chocolate's built in facilities for paging, sorting and filtering? Thanks! Note: I'm happy to contribute a PR, but would need some guidance as this is a complicated area of the Hot Chocolate code base.