Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prebid Core: switch native assets to ortb2 format #8086

Merged
merged 46 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8a79cdd
switch native assets to ortb2 format
FilipStamenkovic Dec 10, 2021
3def5dc
put rendererUrl, adTemplate back in message
FilipStamenkovic Dec 14, 2021
48f06e6
rename ortb2 to ortb
FilipStamenkovic Dec 15, 2021
d8e08c2
typo fix
FilipStamenkovic Jan 4, 2022
639a648
changes to support ortb for native media type
FilipStamenkovic Jan 10, 2022
29eef9c
handle bid won case
FilipStamenkovic Jan 25, 2022
96046ed
mark bid as won on any post message for native
FilipStamenkovic Jan 25, 2022
bc7423d
fix tests for bid_won event for native
FilipStamenkovic Jan 26, 2022
6cab304
add missing imports
FilipStamenkovic Feb 7, 2022
2b66a39
native converting functions
Feb 17, 2022
d2d79dc
convert new native ortb media type object to proprietary format for n…
Feb 18, 2022
c9c0203
fix LGTM.com issue
Feb 18, 2022
4666c4c
added comments; minor fixes
Feb 18, 2022
526db5e
added test for convertOrtbRequestToProprietaryNative + fixes
Feb 18, 2022
d487ed0
add nativeParams to conversion
Mar 28, 2022
f8e6e49
support nativeParams
Apr 14, 2022
baa6cf6
check that when native.ortb is present, it's the only property
Apr 15, 2022
1096207
remove commented code
Apr 19, 2022
18fa58b
removed unnecessary tests
Apr 20, 2022
1ae5be1
added test that checks that BID_WON is not fired more than once for t…
Apr 20, 2022
a2c5866
validation is now performed on ortb data only
Apr 22, 2022
685d298
fix for prebidServer_native_example.html
Apr 22, 2022
20cb53c
PrebidServerBidAdapter also responds in ortb format
Apr 26, 2022
948daef
fix aspect_ratios as an array in tests
Apr 26, 2022
5ca7b8d
LGTM fix - remove unused variables
Apr 26, 2022
194fc95
Better name for native constants
May 3, 2022
eceeead
use WeakSet instead of Set
May 3, 2022
bc1bbf1
when native request is openRTB, the whole native.ortb is passed over
May 3, 2022
5957c98
retain some defaults dor native PBS request
May 3, 2022
44cc459
fix for empty ortbRequest in nativeBidIsValid
May 19, 2022
5c227f9
add non-asset properties to media type object
May 23, 2022
55b0ae0
final fixes after rebasing
May 24, 2022
0903aed
handle tracking of soon-deprecated ortb imptrackers and jstracker
musikele May 30, 2022
9ee2ec8
let native ad unit take all horizontal space
Jun 14, 2022
69d80df
pass "mapping" from legacy native to ortb to prebid universal creative
Jun 27, 2022
366e572
Convert ortb assets to legacy for backward compatibility with legacy …
Jul 8, 2022
e273140
add ortb conversion for more bid adapters
Jul 11, 2022
6991d2b
wrap conversion function in FEATURES.NATIVE
Jul 13, 2022
39ed9d3
remove expired bids from native wrapper
Jul 15, 2022
ef807e7
instead of modifying bidresponse, use nativeReq
Jul 15, 2022
6ef7e1d
wrap test in FEATURES.NATIVE
Jul 18, 2022
ca8747f
fix for native mapping in prebidServerBidAdapter
Jul 22, 2022
3479bf1
use copy-on-write to convert ortb requests to legacy
Jul 25, 2022
1155c10
fix comment on function
Jul 25, 2022
ce6b8f3
Merge branch 'master' into native_assets_ortb2
patmmccann Jul 25, 2022
74338ad
Update criteoBidAdapter.js
patmmccann Jul 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integrationExamples/gpt/prebidServer_native_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@
<script>
// GPT setup
googletag.cmd.push(function () {
// var slot1 = googletag.defineSlot('/19968336/prebid_native_example_1', [[360, 360]], 'div-1').addService(googletag.pubads());
// var slot2 = googletag.defineSlot('/19968336/prebid_native_example_2', 'fluid', 'div-2').addService(googletag.pubads());
googletag.defineSlot('/19968336/prebid_native_example_1', [[360, 360]], 'div-1').addService(googletag.pubads());
googletag.defineSlot('/19968336/prebid_native_example_2', 'fluid', 'div-2').addService(googletag.pubads());
googletag.pubads().disableInitialLoad();
googletag.pubads().enableSingleRequest();
googletag.enableServices();
Expand Down
4 changes: 4 additions & 0 deletions modules/ablidaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { triggerPixel } from '../src/utils.js';
import {config} from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'ablida';
const ENDPOINT_URL = 'https://bidder.ablida.net/prebid';
Expand All @@ -28,6 +29,9 @@ export const spec = {
* @param bidderRequest
*/
buildRequests: function (validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

if (validBidRequests.length === 0) {
return [];
}
Expand Down
4 changes: 4 additions & 0 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {Renderer} from '../src/Renderer.js';
import {OUTSTREAM} from '../src/video.js';
import { getGlobal } from '../src/prebidGlobal.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'adagio';
const LOG_PREFIX = 'Adagio:';
Expand Down Expand Up @@ -882,6 +883,9 @@ export const spec = {
},

buildRequests(validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

const secure = (location.protocol === 'https:') ? 1 : 0;
const device = internal.getDevice();
const site = internal.getSite(bidderRequest);
Expand Down
4 changes: 4 additions & 0 deletions modules/adbookpspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
uniques
} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

/**
* CONSTANTS
Expand Down Expand Up @@ -101,6 +102,9 @@ function isBidRequestValid(bidRequest) {
}

function buildRequests(validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

const requests = [];

if (validBidRequests.length > 0) {
Expand Down
4 changes: 4 additions & 0 deletions modules/adfBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {_map, deepAccess, deepSetValue, mergeDeep, parseSizesInput} from '../src/utils.js';
import {config} from '../src/config.js';
import {Renderer} from '../src/Renderer.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const { getConfig } = config;

Expand Down Expand Up @@ -60,6 +61,9 @@ export const spec = {
return !!(mid || (inv && mname));
},
buildRequests: (validBidRequests, bidderRequest) => {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

let app, site;

const commonFpd = bidderRequest.ortb2 || {};
Expand Down
3 changes: 3 additions & 0 deletions modules/adgenerationBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {tryAppendQueryString, getBidIdParameter} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, NATIVE} from '../src/mediaTypes.js';
import {config} from '../src/config.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const ADG_BIDDER_CODE = 'adgeneration';

Expand All @@ -25,6 +26,8 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
const ADGENE_PREBID_VERSION = '1.4.0';
let serverRequests = [];
for (let i = 0, len = validBidRequests.length; i < len; i++) {
Expand Down
4 changes: 4 additions & 0 deletions modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {find, includes} from '../src/polyfill.js';
import {config} from '../src/config.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

/*
* In case you're AdKernel whitelable platform's client who needs branded adapter to
Expand Down Expand Up @@ -119,6 +120,9 @@ export const spec = {
* @returns {ServerRequest[]}
*/
buildRequests: function (bidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
bidRequests = convertOrtbRequestToProprietaryNative(bidRequests);

let impGroups = groupImpressionsByHostZone(bidRequests, bidderRequest.refererInfo);
let requests = [];
let schain = bidRequests[0].schain;
Expand Down
4 changes: 4 additions & 0 deletions modules/admanBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import { isFn, deepAccess, logMessage } from '../src/utils.js';
import {config} from '../src/config.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'adman';
const AD_URL = 'https://pub.admanmedia.com/?c=o&m=multi';
Expand Down Expand Up @@ -63,6 +64,9 @@ export const spec = {
},

buildRequests: (validBidRequests = [], bidderRequest) => {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

let winTop = window;
let location;
// TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
Expand Down
4 changes: 4 additions & 0 deletions modules/admixerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { logError } from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {config} from '../src/config.js';
import {BANNER, VIDEO, NATIVE} from '../src/mediaTypes.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'admixer';
const ALIASES = ['go2net', 'adblender', 'adsyield', 'futureads'];
Expand All @@ -20,6 +21,9 @@ export const spec = {
* Make a server request from the list of BidRequests.
*/
buildRequests: function (validRequest, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validRequest = convertOrtbRequestToProprietaryNative(validRequest);

let w;
let docRef;
do {
Expand Down
4 changes: 4 additions & 0 deletions modules/adnowBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, NATIVE} from '../src/mediaTypes.js';
import {deepAccess, parseQueryStringParameters, parseSizesInput} from '../src/utils.js';
import {includes} from '../src/polyfill.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'adnow';
const ENDPOINT = 'https://n.ads3-adnow.com/a';
Expand Down Expand Up @@ -48,6 +49,9 @@ export const spec = {
* @return {ServerRequest}
*/
buildRequests(validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

return validBidRequests.map(req => {
const mediaType = this._isBannerRequest(req) ? BANNER : NATIVE;
const codeId = parseInt(req.params.codeId, 10);
Expand Down
3 changes: 3 additions & 0 deletions modules/adotBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {isArray, isBoolean, isFn, isPlainObject, isStr, logError, replaceAuction
import {find} from '../src/polyfill.js';
import {config} from '../src/config.js';
import {OUTSTREAM} from '../src/video.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'adot';
const ADAPTER_VERSION = 'v2.0.0';
Expand Down Expand Up @@ -373,6 +374,8 @@ function splitAdUnits(validBidRequests) {
* @returns {Array<AjaxRequest>}
*/
function buildRequests(validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
const adUnits = splitAdUnits(validBidRequests);
const publisherPathConfig = config.getConfig('adot.publisherPath');
const publisherPath = publisherPathConfig === undefined ? '' : '/' + publisherPathConfig;
Expand Down
4 changes: 4 additions & 0 deletions modules/adprimeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import { isFn, deepAccess, logMessage } from '../src/utils.js';
import { config } from '../src/config.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'adprime';
const AD_URL = 'https://delta.adprime.com/pbjs';
Expand Down Expand Up @@ -50,6 +51,9 @@ export const spec = {
},

buildRequests: (validBidRequests = [], bidderRequest) => {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

let winTop = window;
let location;
// TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
Expand Down
4 changes: 4 additions & 0 deletions modules/adrelevantisBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {find, includes} from '../src/polyfill.js';
import {INSTREAM, OUTSTREAM} from '../src/video.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'adrelevantis';
const URL = 'https://ssp.adrelevantis.com/prebid';
Expand Down Expand Up @@ -71,6 +72,9 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function(bidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
bidRequests = convertOrtbRequestToProprietaryNative(bidRequests);

const tags = bidRequests.map(bidToTag);
const userObjBid = find(bidRequests, hasUserInfo);
let userObj;
Expand Down
3 changes: 3 additions & 0 deletions modules/adrinoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import {triggerPixel} from '../src/utils.js';
import {NATIVE} from '../src/mediaTypes.js';
import {config} from '../src/config.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'adrino';
const REQUEST_METHOD = 'POST';
Expand All @@ -28,6 +29,8 @@ export const spec = {
},

buildRequests: function (validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
const bidRequests = [];

for (let i = 0; i < validBidRequests.length; i++) {
Expand Down
4 changes: 4 additions & 0 deletions modules/adtrueBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {config} from '../src/config.js';
import {getStorageManager} from '../src/storageManager.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'adtrue';
const storage = getStorageManager({bidderCode: BIDDER_CODE});
Expand Down Expand Up @@ -450,6 +451,9 @@ export const spec = {
},

buildRequests: function (validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

let refererInfo;
if (bidderRequest && bidderRequest.refererInfo) {
refererInfo = bidderRequest.refererInfo;
Expand Down
4 changes: 4 additions & 0 deletions modules/aduptechBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {deepAccess, getAdUnitSizes} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, NATIVE} from '../src/mediaTypes.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

export const BIDDER_CODE = 'aduptech';
export const ENDPOINT_URL_PUBLISHER_PLACEHOLDER = '{PUBLISHER}';
Expand Down Expand Up @@ -198,6 +199,9 @@ export const spec = {
* @returns {Object[]}
*/
buildRequests: (validBidRequests, bidderRequest) => {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

const requests = [];

// stop here on invalid or empty data
Expand Down
4 changes: 4 additions & 0 deletions modules/adxcgBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
triggerPixel
} from '../src/utils.js';
import {config} from '../src/config.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const { getConfig } = config;

Expand Down Expand Up @@ -65,6 +66,9 @@ export const spec = {
return !!(adzoneid);
},
buildRequests: (validBidRequests, bidderRequest) => {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

let app, site;

const commonFpd = bidderRequest.ortb2 || {};
Expand Down
3 changes: 3 additions & 0 deletions modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
import {createEidsArray} from './userId/eids.js';
import {find} from '../src/polyfill.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const VERSION = '1.0';
const BIDDER_CODE = 'adyoulike';
Expand Down Expand Up @@ -60,6 +61,8 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (bidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
bidRequests = convertOrtbRequestToProprietaryNative(bidRequests);
let hasVideo = false;
const payload = {
Version: VERSION,
Expand Down
4 changes: 4 additions & 0 deletions modules/ajaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getBidIdParameter, tryAppendQueryString, createTrackPixelHtml, logError
import { Renderer } from '../src/Renderer.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { VIDEO, BANNER, NATIVE } from '../src/mediaTypes.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'aja';
const URL = 'https://ad.as.amanad.adtdp.com/v2/prebid';
Expand Down Expand Up @@ -35,6 +36,9 @@ export const spec = {
* @returns {ServerRequest|ServerRequest[]}
*/
buildRequests: function(validBidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

const bidRequests = [];
const pageUrl = bidderRequest?.refererInfo?.page || undefined;

Expand Down
4 changes: 4 additions & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {INSTREAM, OUTSTREAM} from '../src/video.js';
import {getStorageManager} from '../src/storageManager.js';
import {bidderSettings} from '../src/bidderSettings.js';
import {hasPurpose1Consent} from '../src/utils/gpdr.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'appnexus';
const URL = 'https://ib.adnxs.com/ut/v3/prebid';
Expand Down Expand Up @@ -122,6 +123,9 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (bidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
bidRequests = convertOrtbRequestToProprietaryNative(bidRequests);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like it is overwriting the incoming bidRequests. Should it be just creating a copy instead here? Not sure is this affects downstream prebid core if these input bidRequests object are changed?

For example, if the input has rendererUrl / sendTargetingKeys: false

Then this function overwrites them and they are removed, does the core still handle the bidResponse correctly when it maps back to ortb2 etc?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like the function changes the incoming object anyways, so prob don't need to set it equal to it if it changes it anyways?

Maybe a copy should be returned so the original bidRequests object is not changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @robertrmartinez
You are right, it is overwriting the incoming BidRequests. I tried to create a copy and pass it around, and this would be more correct (from a functional standpoint) and may lead to less bugs, however it is unpractical.

Some bidders in their tests rely on the fact that the bidRequest object they sent is exactly the one that will come back; some check the reference, other check some properties that they are attaching to the object; in the end, creating a copy of bidRequests instead of modifying it in place would mean to fix all their tests.

Regarding the fact that rendererUrl/sendTargetingKeys may disappear: I'll do a change in the code so this will not happen.

To summarize, my idea is that we should create a copy, but this is impossible now, because it will break all the tests that assume that the bidRequest they're testing is the same they sent in input.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@robertrmartinez check the code now!

Copy link
Collaborator

Choose a reason for hiding this comment

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

That all makes sense to me!

Hopefully this is a short term solution and ORTB gets fully adopted and legacy native mediatype is deprecated!

Copy link
Collaborator

Choose a reason for hiding this comment

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

@musikele would a compromise of "copy-on-write" work? since tests should not be setting up native ortb2 right now, if you return the original object when no conversion is necessary, but clone it when it is, I think it might work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dgirardi I've implemented copy-on-write and tests are not failing.


const tags = bidRequests.map(bidToTag);
const userObjBid = find(bidRequests, hasUserInfo);
let userObj = {};
Expand Down
3 changes: 3 additions & 0 deletions modules/apstreamBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { generateUUID, deepAccess, createTrackPixelHtml, getDNT } from '../src/u
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
import { getStorageManager } from '../src/storageManager.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const CONSTANTS = {
DSU_KEY: 'apr_dsu',
Expand Down Expand Up @@ -416,6 +417,8 @@ function isBidRequestValid(bid) {
}

function buildRequests(bidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
bidRequests = convertOrtbRequestToProprietaryNative(bidRequests);
const data = {
med: encodeURIComponent(window.location.href),
auid: bidderRequest.auctionId,
Expand Down
4 changes: 4 additions & 0 deletions modules/bidscubeBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { logMessage, getWindowLocation } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js'
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js'
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

const BIDDER_CODE = 'bidscube'
const URL = 'https://supply.bidscube.com/?c=o&m=multi'
Expand All @@ -15,6 +16,9 @@ export const spec = {
},

buildRequests: function (validBidRequests) {
// convert Native ORTB definition to old-style prebid native definition
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

validBidRequests = validBidRequests || []
let winTop = window
try {
Expand Down
Loading