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
The specified resolver is called once per Metadata object (in this example) and successfully receives the actual object (as Metadata in this example) by calling ctx.Parent<Metadata>().
It is not automatically resolved as a list, which would violate the specified schema.
What is actually happening?
The specified resolver is invoked for each element of the enumerable object and receives System.Collections.Generic.KeyValuePair`2[System.String,System.Object] (in this example) by calling ctx.Parent<Metadata>()
Relevant log output
Exception has occurred: CLR/HotChocolate.GraphQLException
An exception of type'HotChocolate.GraphQLException' occurred in HotChocolate.Execution.dll but was not handled in user code: 'The resolver parent type of field `Metadata.value` is `System.Collections.Generic.KeyValuePair`2[System.String,System.Object]` but the resolver requested the type `HotChocolateIssue.Metadata`. The resolver was unable to cast the parent type to the requested type.'
at HotChocolate.Execution.Processing.MiddlewareContext.Parent[T]()
at HotChocolateIssue.MetadataType.<>c.<Configure>b__0_2(IResolverContext ctx) in /workspaces/HotChocolateDictIssue/HotChocolateIssue/MetadataType.cs:line 24
at HotChocolate.Types.ResolveObjectFieldDescriptorExtensions.<>c__DisplayClass0_0.<Resolve>b__0(IResolverContext ctx)
at HotChocolate.Types.Helpers.FieldMiddlewareCompiler.<>c__DisplayClass9_0.<<CreateResolverMiddleware>b__0>d.MoveNext()
Additional context
No response
The text was updated successfully, but these errors were encountered:
AlexanderInova
changed the title
Resolver for objects derived from dictionaries/lists implicitly apply a list conversion
Resolver for objects derived from dictionaries/lists implicitly applies a list conversion
Jan 9, 2025
Product
Hot Chocolate
Version
14.2.0
Link to minimal reproduction
https://github.com/AlexanderInova/HotChocolateDictIssue
Steps to reproduce
Dictionary<string, object>
:What is expected?
The specified resolver is called once per
Metadata
object (in this example) and successfully receives the actual object (asMetadata
in this example) by callingctx.Parent<Metadata>()
.It is not automatically resolved as a list, which would violate the specified schema.
What is actually happening?
The specified resolver is invoked for each element of the enumerable object and receives
System.Collections.Generic.KeyValuePair`2[System.String,System.Object]
(in this example) by callingctx.Parent<Metadata>()
Relevant log output
Additional context
No response
The text was updated successfully, but these errors were encountered: