You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use dynamic schemas, but seems there is no chance to support fully dynamic entites? I've added type module with dynamic objects and it appears correctly in schema, but I cannot query against this type, since it's not in query type. Is it possible to add this kind of dynamic entity to any of queries? I don't understand the point of dynamic schemas if they cannot be inside a query - because the type is dynamic and can't appear in query class.
After startup I receive 1. The object typeQuery has to at least define one field in order to be valid. (HotChocolate.Types.ObjectType)
I've tried to add AddQueryType<UserQuery>() but still it works only for strongly typed. I need to support dynamic types in my query.
Please write a request if a link with example it's expired.
builder.AddGraphQL().AddQueryType().AddTypeModule<CustomTypeModule>().AddFiltering();publicclassCustomTypeModule:ITypeModule{publiceventEventHandler<EventArgs>?TypesChanged;publicasyncValueTask<IReadOnlyCollection<ITypeSystemMember>>CreateTypesAsync(IDescriptorContextcontext,CancellationTokencancellationToken){// using var db = context.Services.GetRequiredService<UsersDbContext>();//var fields = await db.CustomFields.ToListAsync(cancellationToken);varfields=new[]{newCustomField(){Id=1,Name="field1",Type=CustomFieldType.String,},newCustomField(){Id=1,Name="field2",Type=CustomFieldType.String,}};vartypes=newList<ITypeSystemMember>();vartypeDefinition=newObjectTypeDefinition("DynamicUser",runtimeType:typeof(Dictionary<string,object>));foreach(varfieldinfields){typeDefinition.Fields.Add(newObjectFieldDefinition(field.Name,type:TypeReference.Parse($"{field.Type.ToString()}!"),pureResolver: x =>x.Parent<Dictionary<string,object>>()[field.Name]));}types.Add(ObjectType.CreateUnsafe(typeDefinition));returntypes;}}
Schema:
schema {query: UserQuery}
...
type DynamicUser {field1: String1field2: String1}
What is expected?
Dynamic schema works correctly, so I can query my dynamic objects
What is actually happening?
There is an error about empty query
Relevant log output
### Additional context
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
HotChocolate.SchemaException: For more details look at the `Errors` property.
1. The object type`Query` has to at least define one field in order to be valid. (HotChocolate.Types.ObjectType)
at HotChocolate.SchemaBuilder.Setup.CompleteSchema(SchemaBuilder builder, IDescriptorContext context, LazySchema lazySchema, TypeRegistry typeRegistry)
at HotChocolate.SchemaBuilder.Setup.Create(SchemaBuilder builder, LazySchema lazySchema, IDescriptorContext context)
at HotChocolate.SchemaBuilder.Create(IDescriptorContext context)
at HotChocolate.SchemaBuilder.HotChocolate.ISchemaBuilder.Create(IDescriptorContext context)
at HotChocolate.Execution.RequestExecutorResolver.CreateSchemaAsync(ConfigurationContext context, RequestExecutorSetup setup, RequestExecutorOptions executorOptions, IServiceProvider schemaServices, TypeModuleChangeMonitor typeModuleChangeMonitor, CancellationToken cancellationToken)
at HotChocolate.Execution.RequestExecutorResolver.CreateSchemaServicesAsync(ConfigurationContext context, RequestExecutorSetup setup, CancellationToken cancellationToken)
at HotChocolate.Execution.RequestExecutorResolver.GetRequestExecutorNoLockAsync(String schemaName, CancellationToken cancellationToken)
at HotChocolate.Execution.RequestExecutorResolver.GetRequestExecutorAsync(String schemaName, CancellationToken cancellationToken)
at HotChocolate.Execution.RequestExecutorProxy.GetRequestExecutorAsync(CancellationToken cancellationToken)
at HotChocolate.AspNetCore.HttpPostMiddlewareBase.HandleRequestAsync(HttpContext context)
at HotChocolate.AspNetCore.HttpPostMiddlewareBase.InvokeAsync(HttpContext context)
at Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.<>c__DisplayClass23_0.<<UseCancellation>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
The text was updated successfully, but these errors were encountered:
Product
Hot Chocolate
Version
15
Link to minimal reproduction
https://limewire.com/d/60631da7-56df-467f-a526-b5cd9fb1f5aa#KiK53SBHFrFdyZmGdEBVb5X6yt1MQNTBEgKEIKksCD0
Steps to reproduce
Hi,
I tried to use dynamic schemas, but seems there is no chance to support fully dynamic entites? I've added type module with dynamic objects and it appears correctly in schema, but I cannot query against this type, since it's not in query type. Is it possible to add this kind of dynamic entity to any of queries? I don't understand the point of dynamic schemas if they cannot be inside a query - because the type is dynamic and can't appear in query class.
After startup I receive
1. The object type
Queryhas to at least define one field in order to be valid. (HotChocolate.Types.ObjectType)
I've tried to add
AddQueryType<UserQuery>()
but still it works only for strongly typed. I need to support dynamic types in my query.https://chillicream.com/docs/hotchocolate/v15/defining-a-schema/dynamic-schemas
Please write a request if a link with example it's expired.
Schema:
What is expected?
Dynamic schema works correctly, so I can query my dynamic objects
What is actually happening?
There is an error about empty query
Relevant log output
The text was updated successfully, but these errors were encountered: