Skip to content

Support Option-wrapped inner ID types when using global object identification #6

@cmeeren

Description

@cmeeren

Seemingly blocked by upstream.

Option-wrapped ID inside arrays don't serialize when using global object identification. It fails with the exception below. Based on the stack trace and the use of Array.SetValue and elementType in these lines in HotChocolate, my understanding is that HotChocolate tries to set the "raw" (non-option-wrapped) values in an array with option-wrapped values.

Object cannot be stored in an array of this type.
   at System.Array.InternalSetValue(Object value, IntPtr flattenedIndex)
   at HotChocolate.Types.Relay.GlobalIdInputValueFormatter.FormatInternal(Object originalValue)
   at HotChocolate.Types.Relay.GlobalIdInputValueFormatter.Format(Object originalValue)
   at HotChocolate.Types.InputParser.FormatValue(IInputFieldInfo field, Object value)
   at HotChocolate.Types.InputParser.ParseObject(IValueNode resultValue, InputObjectType type, Path path, Int32 stack, Boolean defaults)
   at HotChocolate.Types.InputParser.ParseLiteralInternal(IValueNode value, IType type, Path path, Int32 stack, Boolean defaults, IInputFieldInfo field)
   at HotChocolate.Types.InputParser.ParseLiteralInternal(IValueNode value, IType type, Path path, Int32 stack, Boolean defaults, IInputFieldInfo field)
   at HotChocolate.Types.InputParser.ParseLiteral(IValueNode value, IInputFieldInfo field, Type targetType)
   at HotChocolate.Execution.Processing.MiddlewareContext.CoerceArgumentValue[T](ArgumentValue argument)
   at HotChocolate.Execution.Processing.MiddlewareContext.ArgumentValue[T](String name)
   at lambda_method96(Closure, IResolverContext)
   at HotChocolate.Types.Helpers.FieldMiddlewareCompiler.<>c__DisplayClass9_0.<<CreateResolverMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at HotChocolate.Execution.Processing.Tasks.ResolverTask.ExecuteResolverPipelineAsync(CancellationToken cancellationToken)
   at HotChocolate.Execution.Processing.Tasks.ResolverTask.TryExecuteAsync(CancellationToken cancellationToken)"

@michaelstaib, do you know if this can be worked around, or does this need a change to HC internals?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions