All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sttp.tapir.internal.ComplietimeErrors.scala Maven / Gradle / Ivy

There is a newer version: 1.11.11
Show newest version
package sttp.tapir.internal

import scala.quoted.*

private[tapir] object ComplietimeErrors {
  inline def reportIncorrectMapping[SOURCE, TARGET] = ${ reportIncorrectMappingImpl[SOURCE, TARGET] }

  private def reportIncorrectMappingImpl[SOURCE: Type, TARGET: Type](using Quotes): Expr[Unit] = {
    import quotes.reflect.*

    if TypeRepr.of[TARGET].typeSymbol.declaredFields.size > 22 then
      report.errorAndAbort(
        s"Cannot map to ${Type.show[TARGET]}: arities of up to 22 are supported. If you need more inputs/outputs, map them to classes with less fields, and then combine these classes."
      )
    else report.errorAndAbort(s"Failed to map ${Type.show[SOURCE]} into ${Type.show[TARGET]}")
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy