byme8 / ZeroQL

C# GraphQL client with Linq-like syntax
MIT License
278 stars 13 forks source link

Nullable properties of input arguments lead to NullReferenceException in generated code #48

Closed macgyver2k closed 1 year ago

macgyver2k commented 1 year ago

Running with 4.1.0-preview.2 on dotnet 7.0 i am having an issue with the following input type. Both fields are nullable/optional. The server would expect one of them to be provided:

input MonitorRelateToOneForCreateInput {
  create: MonitorCreateInput
  connect: MonitorWhereUniqueInput
}

The generated code treats both of them as required and tries to get the values of the fields, even if they can be null. This leads to a System.NullReferenceException

image image

It should be possible to send input objects with nullable properties.

byme8 commented 1 year ago

I will have a look

byme8 commented 1 year ago

Checkout v4.1.0-preview.4. The issue should be fixed.

macgyver2k commented 1 year ago

Thank you very much. Works perfectly!