Skip to content

OMS: add video support#3779

Merged
CTMBNara merged 7 commits into
masterfrom
OMS-Video-support-#3770
Apr 17, 2025
Merged

OMS: add video support#3779
CTMBNara merged 7 commits into
masterfrom
OMS-Video-support-#3770

Conversation

@przemkaczmarek
Copy link
Copy Markdown
Collaborator

🔧 Type of changes

  • bid adapter update

✨ What's the context?

#3770

@osulzhenko osulzhenko linked an issue Feb 25, 2025 that may be closed by this pull request
@osulzhenko osulzhenko changed the title OMS: Video support #3770 OMS: add video support Feb 28, 2025
@CTMBNara CTMBNara requested a review from AntoxaAntoxic March 4, 2025 17:19

String pid;

Integer publisherId;
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.

add JsonProperty

also I would change the integration test payload to cover publisherId parameter

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I have cheanged pid to publisherId but IMO its indifferent

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.

the pid is declared as deprecated

Copy link
Copy Markdown
Collaborator

@AntoxaAntoxic AntoxaAntoxic Mar 10, 2025

Choose a reason for hiding this comment

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

I meant, it makes sense to add a publisherId to the test instead of deprecated pid, but pid is still can be used, it's deprecated, not removed, please revert this change

Comment on lines +42 to +61
public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest request) {
String uri = endpointUrl;

if (!request.getImp().isEmpty()) {
try {
final ExtImpOms impExt = parseImpExt(request.getImp().get(0));
if (impExt != null) {
if (impExt.getPid() != null && !impExt.getPid().isEmpty()) {
uri = String.format("%s?publisherId=%s", endpointUrl, impExt.getPid());
} else if (impExt.getPublisherId() != null && impExt.getPublisherId() > 0) {
uri = String.format("%s?publisherId=%d", endpointUrl, impExt.getPublisherId());
}
}
} catch (PreBidException e) {
return Result.withError(BidderError.badInput(e.getMessage()));
}
}

return Result.withValue(BidderUtil.defaultRequest(request, uri, mapper));
}
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.

I believe it can work this way

            try {
                final ExtImpOms impExt = parseImpExt(request.getImp().getFirst());
                final String publisherId = impExt.getPid() == null && impExt.getPublisherId() != null && impExt.getPublisherId() > 0
                        ? String.valueOf(impExt.getPublisherId())
                        : impExt.getPid();
                final String url = "%s?publisherId=%s".formatted(endpointUrl, publisherId);
                return Result.withValue(BidderUtil.defaultRequest(request, url, mapper));
            } catch (PreBidException e) {
                return Result.withError(BidderError.badInput(e.getMessage()));
            }

.filter(Objects::nonNull)
.flatMap(Collection::stream)
.map(bid -> BidderBid.of(bid, BidType.banner, bidResponse.getCur()))
.map(bid -> BidderBid.of(bid, getBidType(bid.getMtype()), bidResponse.getCur()))
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.

the following is not ported

func getBidVideo(bidType openrtb_ext.BidType, bid *openrtb2.Bid) *openrtb_ext.ExtBidPrebidVideo {
	if bidType != openrtb_ext.BidTypeVideo {
		return nil
	}

	var primaryCategory string
	if len(bid.Cat) > 0 {
		primaryCategory = bid.Cat[0]
	}

	return &openrtb_ext.ExtBidPrebidVideo{
		Duration:        int(bid.Dur),
		PrimaryCategory: primaryCategory,
	}
}

Comment on lines +121 to +125
return catNotEmpty || durationValid
? ExtBidPrebidVideo.of(
durationValid ? duration : null,
catNotEmpty ? cat.getFirst() : null)
: null;
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.

In Go they always create a video object

also a duration validation seems redundant (again, according to Go)

Comment on lines +104 to +108
final Integer markupType = bid.getMtype();
return switch (markupType) {
case 1 -> BidType.banner;
case 2 -> BidType.video;
case null, default -> throw new PreBidException("Unsupported mType " + mType);
case null, default -> BidType.banner;
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.

return Objects.equals(bid.getMtype(), 2) ? BidType.video : BidType.banner;

}

private static ExtBidPrebidVideo videoInfo(Bid bid) {
if (!Integer.valueOf(2).equals(bid.getMtype())) {
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.

I'd use a bid type resolved on the previous step


String pid;

Integer publisherId;
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.

the pid is declared as deprecated

public class ExtImpOms {

String pid;
@JsonProperty("publisherId")
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.

add an empty line

Comment on lines +48 to +49
final String publisherId = impExt.getPublisherId() != null && impExt.getPublisherId() > 0
? String.valueOf(impExt.getPublisherId()) : null;
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.

why did you change it? I believe in the last commit it was correct

Copy link
Copy Markdown
Collaborator Author

@przemkaczmarek przemkaczmarek Mar 10, 2025

Choose a reason for hiding this comment

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

because U said that pid is deprecated

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.

deprecated doesn't mean removed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

so i should add only annotation @deprecated on pid filed ?

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.

the initial point was about using publisherId in the integration test instead of pid, that's it, everything else was fine, the pid is still supported

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In the integration test I used only publisherId.
I used pid only in unit test.
Should it look like this?

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.

yes

: null;
return ExtBidPrebidVideo.of(
duration != null ? duration : 0,
CollectionUtils.isNotEmpty(cat) ? cat.getFirst() : ""
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.

StringUtils.EMPTY

@Value(staticConstructor = "of")
public class ExtImpOms {

String pid;
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.

do not need to remove, since it's present in Go


String pid;

Integer publisherId;
Copy link
Copy Markdown
Collaborator

@AntoxaAntoxic AntoxaAntoxic Mar 10, 2025

Choose a reason for hiding this comment

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

I meant, it makes sense to add a publisherId to the test instead of deprecated pid, but pid is still can be used, it's deprecated, not removed, please revert this change

final BidResponse bidResponse = mapper.decodeValue(httpCall.getResponse().getBody(), BidResponse.class);
return Result.withValues(extractBids(bidResponse));
} catch (DecodeException e) {
} catch (DecodeException | PreBidException e) {
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.

Is PrebidException expected anywhere?

final Integer duration = bid.getDur();

return ExtBidPrebidVideo.of(
duration != null ? duration : 0,
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.

ObjectUtils.defaultIfNull

AntoxaAntoxic
AntoxaAntoxic previously approved these changes Mar 12, 2025
Comment thread src/main/java/org/prebid/server/bidder/oms/OmsBidder.java Outdated
Comment thread src/main/java/org/prebid/server/bidder/oms/OmsBidder.java Outdated
Comment thread src/main/java/org/prebid/server/bidder/oms/OmsBidder.java Outdated
Comment thread src/main/java/org/prebid/server/bidder/oms/OmsBidder.java Outdated
Comment thread src/main/java/org/prebid/server/bidder/oms/OmsBidder.java Outdated
Comment thread src/main/java/org/prebid/server/bidder/oms/OmsBidder.java Outdated
Comment thread src/main/java/org/prebid/server/bidder/oms/OmsBidder.java Outdated
@osulzhenko osulzhenko requested a review from CTMBNara April 11, 2025 05:49
@CTMBNara CTMBNara merged commit 10a041a into master Apr 17, 2025
7 of 8 checks passed
@CTMBNara CTMBNara deleted the OMS-Video-support-#3770 branch April 17, 2025 10:51
riteshghodrao pushed a commit to riteshghodrao/prebid-server-java that referenced this pull request Apr 25, 2026
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.

Port PR from PBS-Go: OMS: Video support

3 participants