hey everyone. is there any way to mark a field as ...
# http4k
r
hey everyone. is there any way to mark a field as optional in auto-modeled http body message? like, define:
Copy code
data class ApproveRequest(val roleId: Int, val extraPermissions: List<InboundPermission> = emptyList())
and
Copy code
private val requestLens = Body.auto<ApproveRequest>().toLens()
want i want is the field
extraPermissions
will be marked as
optional
instead of
required
in generated OpenApi doc because it have a default value. this may seems somewhat unreasonable, but i just met this in my backend application 😅
d
You should be able to just mark the field as billable in the data class.
😉 1
r
thanks! seems marked as nullable and use
null
as default value could fix