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.28k stars 748 forks source link

Guid serialization in strawberry shake only accepts one format. #3562

Closed michaelstaib closed 3 years ago

michaelstaib commented 3 years ago

StrawberryShake only seems to recognize uuid values in "D" form (aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee). Is there a way to get it to use "N" form (aaaaaaaabbbbccccddddeeeeeeeeeeee)?

dmg-hamann commented 3 years ago

Sadly dotnet does only support the "D" format link.

My suggesstion would be to add another JsonElementExtension method. Maybe something like "GetGuidUnkownFormat" and use it in GetParseMethod in the JsonUtils class.

Currently I am struggeling with setting up vscode to run the code. But if I can it to work I will try to provide a pr for the issue.

dmg-hamann commented 3 years ago

After further digging into the code I was not able to get it to work. I guess at some point the GetGuid call to JsonElement should be replaced by Guid.Parse. I am sorry that I was not able yet to find the right spot ;)

matt-psaltis commented 3 years ago

Hit this today as well. I'm continually surprised with the missing features of dotnet's serializer. Thanks to everyone working to make this library even more amazing!

michaelstaib commented 3 years ago

@dmg-hamann so there is a workaround for this.... you can set the serializer to use string serialization and the use Guid.Parse instead of the JsonDocument serialization. We will fix that with the next patch release.