title: Scala - tapir dynamic status codes type mismatching
body: <p>I am creating an endpoint in tapir that requires dynamic status codes for the error out.</p>
  
  <p>I have declared a seal trait <code>FailureResponse</code> and i have created case classes that extends this trait. Similar to the example shown <a href="https://tapir-scala.readthedocs.io/en/latest/endpoint/statuscodes.html" rel="nofollow noreferrer">https://tapir-scala.readthedocs.io/en/latest/endpoint/statuscodes.html</a></p>
  
  <p><strong>Model</strong></p>
  
  <pre><code>object AuthenticationModel {
  
    case class Request(productId: String)
  
    case class SuccessResponse(success: Boolean, status: Int, data: Token, message: String)
  
    sealed trait FailureResponse
    case class FailureResponse400(success: Boolean, status: Int = 400, errors: Array[Error], message: String) extends FailureResponse
    case class FailureResponse401(success: Boolean, status: Int = 401, errors: Array[Error], message: String) extends FailureResponse
    case class FailureResponse422(success: Boolean, status: Int = 422, errors: Array[Error], message: String) extends FailureResponse
    case class FailureResponse500(success: Boolean, status: Int = 500, errors: Array[Error], message: String) extends FailureResponse
  
    case class Token(token: String)
    case class Error(code: String, message: String)
  
  }
  </code></pre>
  
  <p><strong>Endpoint</strong></p>
  
  <pre><code>object Auth {
  
    val authenticationEndpoint : Endpoint[AuthenticationModel.Request, AuthenticationModel.FailureResponse, AuthenticationModel.SuccessResponse, Unit] = endpoint
      .tag("Auth")
      .description("Generates an idcheck token using product id")
      .post
      .in("auth")
      .in(jsonBody[AuthenticationModel.Request])
      .out(jsonBody[AuthenticationModel.SuccessResponse])
      .errorOut(oneOf(
        statusMapping(StatusCode.BadRequest, jsonBody[AuthenticationModel.FailureResponse400]),
        statusMapping(StatusCode.Unauthorized, jsonBody[AuthenticationModel.FailureResponse401]),
        statusMapping(StatusCode.UnprocessableEntity, jsonBody[AuthenticationModel.FailureResponse422]),
        statusMapping(StatusCode.InternalServerError, jsonBody[AuthenticationModel.FailureResponse500]),
      ))
  
  }
  </code></pre>
  
  <p>I have set the error-output parameter type to be <code>AuthenticationModel.FailureResponse</code>. </p>
  
  <p>However i am getting a type mis match </p>
  
  <blockquote>
    <p>Required AuthenticationModel.FailureResponse
    Found AuthenticationModel.FailureResponse with Product with Serializable  </p>
  </blockquote>