graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Wrong code generated when passing a C# struct (custom scalar) as required argument

Open ravasior opened this issue 10 months ago • 1 comments

Product

Strawberry Shake

Version

15.1.3

Link to minimal reproduction

https://github.com/ravasior/StrawberryShake_Struct

Steps to reproduce

open file 'TestProject\GetModelId.graphql' and uncomment the last two lines.

What is expected?

the generated code should compile.

What is actually happening?

the generated code fails with: CS0037: Cannot convert null to 'ModelId' because it is a non-nullable value type

the reason being that the Format method contains code testing the argument for null which is not valid for type struct.

Image

Relevant log output

...\TestProject\obj\Debug\net9.0\berry\MyClient.Client.cs(1188,26,1188,30): error CS0037: Cannot convert null to 'ModelId' because it is a non-nullable value type

Additional context

No response

ravasior avatar Apr 01 '25 07:04 ravasior

I have the same issue.

s2quake avatar Apr 02 '25 01:04 s2quake