In the below example if i miss any field in the request body than it is giving the error in parsing as missing field. Can we anyway ignore it if the field is not present than it should not give error while parsing request. Also in response if the field is empty than it should not return those field in the response. How can we achieve this?
import sttp.tapir.generic.auto._
import sttp.tapir.json.circe.jsonBody
import sttp.tapir.server.ServerEndpoint
import sttp.tapir.{Endpoint, _}
case class Request{field1:String,field2:String}
case class Response{field1:String,field2:String}
private lazy val reqBody = jsonBody[Request]
private lazy val respBody = jsonBody[Response]
private val postEP: Endpoint[Unit, (CommonHeader, Request), (StatusCode, ErrorInfo), (StatusCode, Response), Any] =
baseEndpoint.post
.in("test")
.in(reqBody)
.out(statusCode.and(respBody))