Dsps should forcibly reply native responses when requests contains native request.
hence the following code should be using the bid request to determine if impression is native based.
implicit val admOneOfDecoder: Decoder[SeatBid.Bid.AdmOneof] = { cursor =>
cursor.focus.map {
case json if json.isString =>
json.asString
.map(s => {
decode[NativeResponse](s)
.map(AdmOneof.AdmNative) // the string can be decoded as native
.getOrElse(AdmOneof.Adm(s)) // the string cannot be decoded
})
.getOrElse(AdmOneof.Empty) // there's no string or it's impossible to decode it
case json if json.isObject =>
json.as[NativeResponse].map(AdmOneof.AdmNative).getOrElse(AdmOneof.Empty)
}.orElse(Some(AdmOneof.Empty)).map(Right(_)).get
}
Dsps should forcibly reply native responses when requests contains native request.
hence the following code should be using the bid request to determine if impression is native based.