Skip to content

Nativo adapter: Update bid type resolution - #4690

Open
shawnhe wants to merge 2 commits into
prebid:masterfrom
life360-oss:ADS-10178
Open

shawnhe wants to merge 2 commits into
prebid:masterfrom
life360-oss:ADS-10178

Conversation

@shawnhe

@shawnhe shawnhe commented Oct 28, 2026 •

Copy link
Copy Markdown

…d in mtype.

🔧 Type of changes

  • new bid adapter
  • bid adapter update
  • new feature
  • new analytics adapter
  • new module
  • module update
  • bugfix
  • documentation
  • configuration
  • dependency update
  • tech debt (test coverage, refactorings, etc.)

✨ What's the context?

Nativo's server sets mtype on every bid. The adapter ignored it and inferred the media type from the request imp (native, then video, then banner), which mislabels bids on multi-format imps, for example a banner win on a banner + video imp reported as video.

🧠 Rationale behind the change

The adapter now uses bid.MType (1 banner, 2 video, 3 audio, 4 native) when present, as Prebid recommends. If it's missing or unrecognized, the existing imp-based and ext.prebid.type logic runs unchanged, so responses without mtype behave as before. New fixtures cover multi-format imps, audio, an unrecognized mtype and an unknown imp.

🔎 New Bid Adapter Checklist

  • verify email contact works
  • NO fully dynamic hostnames
  • geographic host parameters are NOT required
  • direct use of HTTP is prohibited - implement an existing Bidder interface that will do all the job
  • if the ORTB is just forwarded to the endpoint, use the generic adapter - define the new adapter as the alias of the generic adapter
  • cover an adapter configuration with an integration test

🧪 Test plan

How do you know the changes are safe to ship to production?

🏎 Quality check

  • Are your changes following our code style guidelines?
  • Are there any breaking changes in your code?
  • Does your test coverage exceed 90%?
  • Are there any erroneous console logs, debuggers or leftover code in your changes?

@osulzhenko osulzhenko changed the title ADS-10178: Label each bid with the format the Nativo exchange returne… Nativo adapter: Update bid type resolution Oct 28, 2026
osulzhenko
osulzhenko previously approved these changes Oct 28, 2026
Comment on lines +267 to +282
@Test
public void makeBidsShouldReturnNativeBidWhenMtypeIsNativeOnBannerAndNativeImp() throws JsonProcessingException {
// given
final BidRequest bidRequest = givenBidRequest(imp -> imp.id("imp1")
.banner(Banner.builder().build())
.xNative(Native.builder().build()));
final Bid bid = givenBid("bid1", "imp1", 4);
final BidderCall<BidRequest> httpCall = givenHttpCall(bidRequest, givenBidResponse(singletonList(bid)));

// when
final Result<List<BidderBid>> result = target.makeBids(httpCall, bidRequest);

// then
assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue()).containsExactly(BidderBid.of(bid, BidType.xNative, "USD"));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change test name to makeBidsShouldReturnNativeBidWhenMtypeIsNative. Remove banner and native from imp

Comment on lines +284 to +299
@Test
public void makeBidsShouldReturnBannerBidWhenMtypeIsBannerOnBannerAndVideoImp() throws JsonProcessingException {
// given
final BidRequest bidRequest = givenBidRequest(imp -> imp.id("imp1")
.banner(Banner.builder().build())
.video(Video.builder().build()));
final Bid bid = givenBid("bid1", "imp1", 1);
final BidderCall<BidRequest> httpCall = givenHttpCall(bidRequest, givenBidResponse(singletonList(bid)));

// when
final Result<List<BidderBid>> result = target.makeBids(httpCall, bidRequest);

// then
assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue()).containsExactly(BidderBid.of(bid, BidType.banner, "USD"));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines +301 to +316
@Test
public void makeBidsShouldReturnVideoBidWhenMtypeIsVideoOnVideoAndNativeImp() throws JsonProcessingException {
// given
final BidRequest bidRequest = givenBidRequest(imp -> imp.id("imp1")
.video(Video.builder().build())
.xNative(Native.builder().build()));
final Bid bid = givenBid("bid1", "imp1", 2);
final BidderCall<BidRequest> httpCall = givenHttpCall(bidRequest, givenBidResponse(singletonList(bid)));

// when
final Result<List<BidderBid>> result = target.makeBids(httpCall, bidRequest);

// then
assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue()).containsExactly(BidderBid.of(bid, BidType.video, "USD"));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines +318 to +335
@Test
public void makeBidsShouldReturnNativeBidWhenMtypeIsNativeOnBannerVideoAndNativeImp()
throws JsonProcessingException {
// given
final BidRequest bidRequest = givenBidRequest(imp -> imp.id("imp1")
.banner(Banner.builder().build())
.video(Video.builder().build())
.xNative(Native.builder().build()));
final Bid bid = givenBid("bid1", "imp1", 4);
final BidderCall<BidRequest> httpCall = givenHttpCall(bidRequest, givenBidResponse(singletonList(bid)));

// when
final Result<List<BidderBid>> result = target.makeBids(httpCall, bidRequest);

// then
assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue()).containsExactly(BidderBid.of(bid, BidType.xNative, "USD"));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this test

Comment on lines +337 to +350
@Test
public void makeBidsShouldReturnAudioBidWhenMtypeIsAudio() throws JsonProcessingException {
// given
final BidRequest bidRequest = givenBidRequest(imp -> imp.id("imp1").banner(Banner.builder().build()));
final Bid bid = givenBid("bid1", "imp1", 3);
final BidderCall<BidRequest> httpCall = givenHttpCall(bidRequest, givenBidResponse(singletonList(bid)));

// when
final Result<List<BidderBid>> result = target.makeBids(httpCall, bidRequest);

// then
assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue()).containsExactly(BidderBid.of(bid, BidType.audio, "USD"));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove banner from imp

…med to makeBidsShouldReturn{Native,Banner,Video}BidWhenMtypeIs{Native,Banner,Video}, all mtype tests now use an imp with no formats (including audio, which loses its banner), and the redundant all-format native test is removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants