ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.26k stars 746 forks source link

[ID] on Optional<List<Guid>?> results in error #4920

Closed sblomstrand closed 4 months ago

sblomstrand commented 2 years ago

Is there an existing issue for this?

Describe the bug

Input properties using [ID] and Optional fails with message The IDs {...} have an invalid format.

Steps to reproduce

[ID]
public Optional<List<Guid>?> Ids { get; set; }

Current workaround is to instead use

[GraphQLType(typeof(ListType<NonNullType<IdType>>))]
public Optional<List<Guid>?> Ids { get; set; }

Relevant log output

No response

Additional Context?

No response

Product

Hot Chocolate

Version

12.4.1, 12.7.0

BryanEuton commented 2 years ago

I tried the above work around in HotChocolate 12.12.1, but it resulted in the following error message: "Unable to convert type from Object to Guid" at HotChocolate.Utilities.DefaultTypeConverter.Convert(Type from, Type to, Object source).

Is this still being worked on?

BickelLukas commented 9 months ago

Optional does also not work for Lists of ids on Input object types. Regardless whether the id is a guid or a string. It always produces the error The IDs have an invalid format.

After some investigation the error is in the GlobalIdInputValueFormatter -> CreateListFactory. This checks if the IsArrayOrList property of the resultType which is false if it is wrapped in an Optional<>

BryanEuton commented 9 months ago

@PascalSenn since @BickelLukas was able to look into why this is happening, can we get this fixed?

Hanskrogh commented 8 months ago

Any status on this?

glen-84 commented 4 months ago

Fixed in #7255 and/or #7256.