Skip to content

Conversation

@gabrielmougard
Copy link

🔧 Type of changes

  • bid adapter update

✨ What's the context?

We have a discrepancy between our Prebid Server and our Tag/PrebidJS integration. It’s not replacing the bidrequest.Imp[0].TagID with our internal value when a TagID is already present. We are able to deliver because the value is set in the bidrequest.Imp[0].Ext.placementID field, but this creates discrepancies between the connectors, and it’s not ideal.

We have a discrepancy between our Prebid Server and our Tag/PrebidJS integration. It’s not replacing the `bidrequest.Imp[0].TagID` with our internal value when a TagID is already present.

We are able to deliver because the value is set in the `bidrequest.Imp[0].Ext.placementID` field, but this creates discrepancies between the connectors, and it’s not ideal.
@osulzhenko osulzhenko requested a review from CTMBNara January 2, 2026 09:18
Comment on lines +98 to +128
@Test
public void makeHttpRequestsShouldOverrideExistingTagIdWithPlacementId() {
final ObjectNode mobkoiExt = impExt("placement-id-from-ext");
final Imp givenImp1 = givenImp(impBuilder -> impBuilder.tagid("existing-tag-id").ext(mobkoiExt));
final Imp givenImp2 = givenImp(identity());
final BidRequest bidRequest = BidRequest.builder().imp(asList(givenImp1, givenImp2)).build();
final Result<List<HttpRequest<BidRequest>>> result = target.makeHttpRequests(bidRequest);

assertThat(result.getValue())
.extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class))
.flatExtracting(BidRequest::getImp)
.extracting(imp -> imp.getTagid())
.containsExactly("placement-id-from-ext", null);
assertThat(result.getErrors()).isEmpty();
}

@Test
public void makeHttpRequestsShouldKeepExistingTagIdWhenPlacementIdIsMissing() {
final ObjectNode mobkoiExt = impExt(null);
final Imp givenImp1 = givenImp(impBuilder -> impBuilder.tagid("existing-tag-id").ext(mobkoiExt));
final Imp givenImp2 = givenImp(identity());
final BidRequest bidRequest = BidRequest.builder().imp(asList(givenImp1, givenImp2)).build();
final Result<List<HttpRequest<BidRequest>>> result = target.makeHttpRequests(bidRequest);

assertThat(result.getValue())
.extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class))
.flatExtracting(BidRequest::getImp)
.extracting(imp -> imp.getTagid())
.containsExactly("existing-tag-id", null);
assertThat(result.getErrors()).isEmpty();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add // given // when // then

final Result<List<HttpRequest<BidRequest>>> result = target.makeHttpRequests(bidRequest);

assertThat(result.getValue())
.extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Extract payload instead

assertThat(result.getValue())
.extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class))
.flatExtracting(BidRequest::getImp)
.extracting(imp -> imp.getTagid())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use method ref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants