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

Don't assume default value for optional value type argument without default value

Open N-Olbert opened this issue 3 months ago • 2 comments

  • Don't assume default value for optional value type argument without default value

Closes #6347 (in this specific format)

Background:

This issue appears to be a side effect of #5317 and/or #4354. If an optional value type argument was not present in the input arguments, the InputParser was changed in 5317 to emit the default value for that type. This was necessary to avoid compilation failures as null can not be converted to the value type.

This PR removes this special handling from the InputParser and instead coalesces null arguments into the default value within the compiler itself. This approach is very similar to how optional values are handled and allows the InputParser to correctly preserve an explicit null argument.

General note: This seems to only affects code-first types. For annotation-based types, we already have the correct nullability information, as an argument of type int? is in fact a Nullable whose default value is null. Anyhow, for code-first types, this is not the case as f. e. BooleanType maps to the runtime-type bool instead of Nullable<bool>.

N-Olbert avatar Sep 30 '25 16:09 N-Olbert

Can you please revert the formatting changes? 🙂

glen-84 avatar Sep 30 '25 19:09 glen-84

Whoops... done

N-Olbert avatar Sep 30 '25 20:09 N-Olbert