Stylianos Gakis
03/15/2023, 11:15 AMinput
type defined as
input FooInput {
someId: ID
}
I get the generated code:
public data class FooInput(
public val someId: Optional<String?> = Optional.Absent,
)
Is there no configuration like we have for generateOptionalOperationVariables.set(false)
that can turn this into a normal nullable too? Or is it that for input
types specifically that we don’t want to do that as the absence of the value vs the explicit null
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 someId
. Is there anything that could be done in the schema or in the codegen that I am missing to help me out here?mbonnin
03/15/2023, 11:18 AMStylianos Gakis
03/15/2023, 11:36 AMOptional.presentIfNotNull
for taking the nullable type and converting it to Optional. Thanks a lot 😊mbonnin
03/15/2023, 11:38 AM// 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)
Stylianos Gakis
03/15/2023, 11:47 AM