implicit def referenceWrites[T <: IndexedItem]()

in app/controllers/Api.scala [23:41]


  implicit def referenceWrites[T <: IndexedItem](implicit
      arnLookup: ArnLookup[T],
      tWrites: Writes[T],
      request: RequestHeader
  ): Writes[Reference[T]] = (o: Reference[T]) => {
    request.getQueryString("_reference") match {
      case Some("inline") =>
        arnLookup
          .item(o.arn, prismDataStore)
          .flatMap { case (label, t) =>
            Api.itemJson(item = t, label = Some(label), expand = true)
          }
          .getOrElse(JsString(o.arn))
      case Some("uri") =>
        Json.toJson(arnLookup.call(o.arn).absoluteURL()(request))
      case _ =>
        Json.toJson(o.arn)
    }
  }