Nullable types for input need a default argument even if it's null #1525
-
With the changes in version 6.2.0 and above, input types that could be nullable did not require a default value. This code would work before version 6.2.0 @GraphQLDescription("")
data class Book(
val title: String?
) Now I get the error @GraphQLDescription("")
data class Book(
val title: String? = null
) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hello, in v6 we dropped the jackson support to deserialize arguments into kotlin types using reflections which requires all types to be provided in the constructor invocation. As highlighted in our docs The default value information is not available, given that the info is not part of the constructor, instead kotlin adds an indirection on top of it and there is no way to access to it through reflections a good example of why we can't just assign null is a non nullable default value data class Foo(
val foo: String? = "foo"
) through reflection we cannot determine whether |
Beta Was this translation helpful? Give feedback.
Hello, in v6 we dropped the jackson support to deserialize arguments into kotlin types using reflections which requires all types to be provided in the constructor invocation.
As highlighted in our docs
https://opensource.expediagroup.com/graphql-kotlin/docs/schema-generator/writing-schemas/arguments/#default-values
The default value information is not available, given that the info is not part of the constructor, instead kotlin adds an indirection on top of it and there is no way to access to it through reflections
a good example of why we can't just assign null is a non nullable default value
through reflection we cannot determine whether
foo…