Am I missing something or do I have to call the `....
# apollo-kotlin
c
Am I missing something or do I have to call the
.toInput()
method on each parameter I pass to an Input object type?
Copy code
val input = CreateEnvelopeInput(
            name = "Name".toInput(),
            balance = 100000.toInput(),
            color = "0fc7a0".toInput(),
            ...
)
Is there an alternative to doing this?
c
I’ve opted for
Input.optional("Name")
although we actually use `val`’s in the code rather than hardcoded values.
👍 1
m
There's no real alternative as we need to model
absent
vs
null
input fields. The only solution would be to make these input fields non null in the schema
👍 1
In most backends,
null
will delete from the db whereas
absent
will leave untouched
👍 1
c
Oh I see. So this isn't the case if the fields are required. I was just confused because I didn't see the
.toInput()
in some of the examples I was looking at.
Thanks for the help!
m
Sure thing!