For an `input` type defined as ```input FooInput {...
# apollo-kotlin
For an
type defined as
Copy code
input FooInput {
  someId: ID
I get the generated code:
Copy code
public data class FooInput(
  public val someId: Optional<String?> = Optional.Absent,
Is there no configuration like we have for
that can turn this into a normal nullable too? Or is it that for
types specifically that we don’t want to do that as the absence of the value vs the explicit
on the value itself matters too much? In our use case I just want to either have the ID or not have it at all, there is no semantic difference between null and the absence of
. Is there anything that could be done in the schema or in the codegen that I am missing to help me out here?
Nope, that's a pain but for GraphQL input fields, nullability implies optionality, you can't distinguish those
Ah makes total sense. Thanks for the links. I will just work with Optional here in that case, and just use
for taking the nullable type and converting it to Optional. Thanks a lot 😊
If you ever want to work with compiler plugins, there's a fun project to make to allow Kotlin default argument to work similarly to Java builders
Copy code
// Notice how someId is **not** Optional
class FooInput(someId: String? = null) {
  val someId: Optional<String?>

FooInput() // someId is Optional.Absent
FooInput("bar") // someId is Optional.Present("bar")
FooInput(null) // someId is Option.Present(null)
Yeah, sounds like a really fun project. Also sounds quite “out of my league” in terms of what I know how to do if I wanna be realistic 😅 But yeah this would make it even more convenient to use in app code.