
com.avsystem.commons.rest.openapi.WhenAbsentInfo.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-rest_2.12 Show documentation
Show all versions of commons-rest_2.12 Show documentation
AVSystem commons library for Scala
The newest version!
package com.avsystem.commons
package rest.openapi
import com.avsystem.commons.meta.{TypedMetadata, infer, reifyAnnot}
import com.avsystem.commons.rest.JsonValue
import com.avsystem.commons.rpc.AsRaw
import com.avsystem.commons.serialization.whenAbsent
case class WhenAbsentInfo[T](
@reifyAnnot annot: whenAbsent[T],
@infer("for @whenAbsent value: ") asJson: AsRaw[JsonValue, T]
) extends TypedMetadata[T] {
val fallbackValue: Opt[JsonValue] =
Try(annot.value).fold(_ => Opt.Empty, v => asJson.asRaw(v).opt)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy