From dd07431ef54c38a2617c04e76b3e7bda9c21f569 Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Mon, 29 Jan 2024 14:21:20 -0500 Subject: [PATCH] Update to OpenRTB 2.6-202309 (#3387) --- adapters/33across/33across.go | 8 +- .../video-validation-fail-size-null.json | 29 ++ .../video-validation-fail-size-partial.json | 30 ++ .../video-validation-fail-size-zero.json | 31 ++ adapters/aax/aax.go | 2 +- adapters/aceex/aceex.go | 2 +- adapters/acuityads/acuityads.go | 2 +- adapters/adapterstest/adapter_test_util.go | 2 +- adapters/adapterstest/test_json.go | 2 +- adapters/adf/adf.go | 2 +- adapters/adgeneration/adgeneration.go | 2 +- adapters/adgeneration/adgeneration_test.go | 2 +- adapters/adhese/adhese.go | 2 +- adapters/adhese/utils.go | 2 +- adapters/adkernel/adkernel.go | 2 +- adapters/adkernelAdn/adkernelAdn.go | 2 +- adapters/adman/adman.go | 2 +- adapters/admixer/admixer.go | 2 +- adapters/adnuntius/adnuntius.go | 2 +- adapters/adocean/adocean.go | 2 +- adapters/adoppler/adoppler.go | 2 +- adapters/adot/adot.go | 2 +- adapters/adot/adot_test.go | 2 +- adapters/adpone/adpone.go | 2 +- adapters/adprime/adprime.go | 2 +- adapters/adquery/adquery.go | 2 +- adapters/adrino/adrino.go | 2 +- adapters/adsinteractive/adsinteractive.go | 2 +- adapters/adtarget/adtarget.go | 2 +- adapters/adtelligent/adtelligent.go | 2 +- adapters/adtrgtme/adtrgtme.go | 2 +- adapters/advangelists/advangelists.go | 2 +- adapters/adview/adview.go | 2 +- adapters/adxcg/adxcg.go | 2 +- adapters/adyoulike/adyoulike.go | 2 +- adapters/aidem/aidem.go | 2 +- adapters/aja/aja.go | 2 +- adapters/algorix/algorix.go | 2 +- adapters/alkimi/alkimi.go | 7 +- adapters/amx/amx.go | 2 +- adapters/amx/amx_test.go | 2 +- adapters/apacdex/apacdex.go | 2 +- adapters/appnexus/appnexus.go | 4 +- adapters/appush/appush.go | 2 +- adapters/audienceNetwork/facebook.go | 51 +-- adapters/automatad/automatad.go | 2 +- adapters/avocet/avocet.go | 4 +- adapters/avocet/avocet_test.go | 4 +- adapters/axis/axis.go | 2 +- adapters/axonix/axonix.go | 2 +- adapters/beachfront/beachfront.go | 26 +- .../supplemental/adm-video-no-size.json | 124 +++++++ .../supplemental/adm-video-partial-size.json | 125 +++++++ .../adm-video-zero-size-partial.json | 126 +++++++ .../supplemental/adm-video-zero-size.json | 126 +++++++ adapters/beintoo/beintoo.go | 2 +- adapters/bematterfull/bematterfull.go | 2 +- adapters/between/between.go | 2 +- adapters/beyondmedia/beyondmedia.go | 2 +- adapters/bidder.go | 2 +- adapters/bidmachine/bidmachine.go | 4 +- adapters/bidmyadz/bidmyadz.go | 2 +- adapters/bidscube/bidscube.go | 2 +- adapters/bidstack/bidstack.go | 2 +- adapters/bidstack/bidstack_test.go | 2 +- adapters/bizzclick/bizzclick.go | 2 +- adapters/bliink/bliink.go | 2 +- adapters/blue/blue.go | 2 +- adapters/bluesea/bluesea.go | 2 +- adapters/bmtm/brightmountainmedia.go | 2 +- adapters/boldwin/boldwin.go | 2 +- adapters/brave/brave.go | 2 +- .../bad-imp-video-missing-partial-sizes.json | 145 ++++++++ .../bad-imp-video-zero-sizes.json | 38 ++ .../cadent_aperture_mx/cadentaperturemx.go | 6 +- adapters/ccx/ccx.go | 2 +- adapters/coinzilla/coinzilla.go | 2 +- adapters/colossus/colossus.go | 2 +- adapters/compass/compass.go | 2 +- adapters/connectad/connectad.go | 2 +- adapters/consumable/consumable.go | 6 +- adapters/consumable/consumable_test.go | 12 +- adapters/conversant/conversant.go | 4 +- adapters/cpmstar/cpmstar.go | 2 +- adapters/criteo/criteo.go | 2 +- adapters/cwire/cwire.go | 2 +- adapters/datablocks/datablocks.go | 2 +- adapters/decenterads/decenterads.go | 2 +- adapters/deepintent/deepintent.go | 2 +- adapters/definemedia/definemedia.go | 2 +- adapters/dianomi/dianomi.go | 2 +- adapters/dmx/dmx.go | 4 +- adapters/dmx/dmx_test.go | 6 +- adapters/dxkulture/dxkulture.go | 2 +- adapters/e_volution/evolution.go | 2 +- adapters/edge226/edge226.go | 2 +- adapters/emtv/emtv.go | 2 +- adapters/eplanning/eplanning.go | 8 +- .../video-partial-size-send-640x480.json | 71 ++++ .../video-zero-size-send-640x480.json | 72 ++++ adapters/epom/epom.go | 2 +- adapters/flipp/flipp.go | 2 +- adapters/flipp/flipp_test.go | 2 +- adapters/freewheelssp/freewheelssp.go | 2 +- adapters/frvradn/frvradn.go | 2 +- adapters/gamma/gamma.go | 4 +- adapters/gamoshi/gamoshi.go | 2 +- adapters/globalsun/globalsun.go | 2 +- adapters/gothamads/gothamads.go | 2 +- adapters/grid/grid.go | 2 +- adapters/gumgum/gumgum.go | 4 +- .../supplemental/video-missing-size.json | 35 ++ .../supplemental/video-partial-size.json | 36 ++ .../supplemental/video-zero-size.json | 37 ++ adapters/huaweiads/huaweiads.go | 41 ++- .../supplemental/missing_video_size.json | 336 +++++++++++++++++ .../supplemental/zero_video_size.json | 338 ++++++++++++++++++ adapters/imds/imds.go | 2 +- adapters/impactify/impactify.go | 2 +- adapters/improvedigital/improvedigital.go | 2 +- adapters/infoawarebidder.go | 2 +- adapters/infoawarebidder_test.go | 2 +- adapters/infytv/infytv.go | 2 +- adapters/inmobi/inmobi.go | 2 +- .../interactiveoffers/interactiveoffers.go | 2 +- adapters/invibes/invibes.go | 2 +- adapters/iqx/iqx.go | 2 +- adapters/iqzone/iqzone.go | 2 +- adapters/ix/ix.go | 11 +- adapters/ix/ix_test.go | 13 +- adapters/jixie/jixie.go | 2 +- adapters/kargo/kargo.go | 2 +- adapters/kayzen/kayzen.go | 2 +- adapters/kidoz/kidoz.go | 2 +- adapters/kidoz/kidoz_test.go | 2 +- adapters/kiviads/kiviads.go | 2 +- adapters/krushmedia/krushmedia.go | 2 +- adapters/lemmadigital/lemmadigital.go | 2 +- adapters/liftoff/liftoff.go | 2 +- adapters/limelightDigital/limelightDigital.go | 2 +- adapters/lm_kiviads/lmkiviads.go | 2 +- adapters/lockerdome/lockerdome.go | 2 +- adapters/logan/logan.go | 2 +- adapters/logicad/logicad.go | 2 +- adapters/lunamedia/lunamedia.go | 2 +- adapters/mabidder/mabidder.go | 2 +- adapters/madvertise/madvertise.go | 4 +- .../exemplary/simple-video.json | 1 + adapters/marsmedia/marsmedia.go | 2 +- adapters/medianet/medianet.go | 2 +- adapters/mgid/mgid.go | 2 +- adapters/mgidX/mgidX.go | 2 +- adapters/minutemedia/minutemedia.go | 2 +- adapters/mobfoxpb/mobfoxpb.go | 2 +- adapters/mobilefuse/mobilefuse.go | 2 +- adapters/motorik/motorik.go | 2 +- adapters/nextmillennium/nextmillennium.go | 2 +- adapters/nobid/nobid.go | 2 +- adapters/oms/oms.go | 5 +- adapters/onetag/onetag.go | 2 +- adapters/openweb/openweb.go | 2 +- adapters/openx/openx.go | 2 +- adapters/openx/openx_test.go | 2 +- adapters/operaads/operaads.go | 7 +- adapters/orbidder/orbidder.go | 2 +- adapters/orbidder/orbidder_test.go | 2 +- adapters/outbrain/outbrain.go | 6 +- adapters/ownadx/ownadx.go | 2 +- adapters/pangle/pangle.go | 2 +- adapters/pgamssp/pgamssp.go | 2 +- adapters/pubmatic/pubmatic.go | 10 +- adapters/pubmatic/pubmatic_test.go | 2 +- adapters/pubnative/pubnative.go | 7 +- adapters/pulsepoint/pulsepoint.go | 2 +- adapters/pwbid/pwbid.go | 2 +- adapters/relevantdigital/relevantdigital.go | 2 +- adapters/revcontent/revcontent.go | 2 +- adapters/richaudience/richaudience.go | 8 +- adapters/richaudience/richaudience_test.go | 2 +- .../supplemental/videoSizePartial.json | 42 +++ .../supplemental/videoSizeZero.json | 43 +++ adapters/rise/rise.go | 2 +- adapters/rtbhouse/rtbhouse.go | 2 +- adapters/rubicon/rubicon.go | 4 +- adapters/rubicon/rubicon_test.go | 25 +- adapters/sa_lunamedia/salunamedia.go | 2 +- adapters/screencore/screencore.go | 2 +- adapters/seedingAlliance/seedingAlliance.go | 2 +- .../seedingAlliance/seedingAlliance_test.go | 2 +- adapters/sharethrough/sharethrough.go | 2 +- adapters/silvermob/silvermob.go | 2 +- adapters/silverpush/devicetype.go | 2 +- adapters/silverpush/silverpush.go | 7 +- adapters/silverpush/silverpush_test.go | 2 +- adapters/smaato/smaato.go | 7 +- adapters/smaato/smaato_test.go | 9 +- adapters/smartadserver/smartadserver.go | 2 +- .../exemplary/native-app.json | 1 + adapters/smarthub/smarthub.go | 2 +- adapters/smartrtb/smartrtb.go | 2 +- adapters/smartx/smartx.go | 2 +- adapters/smartyads/smartyads.go | 2 +- adapters/smilewanted/smilewanted.go | 2 +- adapters/sonobi/sonobi.go | 2 +- adapters/sovrn/sovrn.go | 2 +- adapters/sovrnXsp/sovrnXsp.go | 2 +- adapters/sspBC/sspbc.go | 2 +- adapters/stroeerCore/stroeercore.go | 2 +- adapters/taboola/taboola.go | 4 +- adapters/tappx/tappx.go | 2 +- adapters/teads/teads.go | 2 +- adapters/telaria/telaria.go | 2 +- adapters/tpmn/tpmn.go | 2 +- adapters/trafficgate/trafficgate.go | 2 +- adapters/triplelift/triplelift.go | 2 +- .../triplelift_native/triplelift_native.go | 2 +- adapters/ucfunnel/ucfunnel.go | 2 +- adapters/ucfunnel/ucfunnel_test.go | 2 +- adapters/undertone/undertone.go | 2 +- adapters/unicorn/unicorn.go | 2 +- adapters/unruly/unruly.go | 2 +- adapters/videobyte/videobyte.go | 2 +- adapters/videoheroes/videoheroes.go | 2 +- adapters/vidoomy/vidoomy.go | 7 +- adapters/visiblemeasures/visiblemeasures.go | 2 +- adapters/visx/visx.go | 2 +- adapters/vox/vox.go | 2 +- adapters/vrtcal/vrtcal.go | 2 +- adapters/xeworks/xeworks.go | 2 +- adapters/yahooAds/yahooAds.go | 7 +- adapters/yandex/yandex.go | 2 +- adapters/yeahmobi/yeahmobi.go | 2 +- adapters/yieldlab/yieldlab.go | 7 +- adapters/yieldlab/yieldlab_test.go | 2 +- adapters/yieldmo/yieldmo.go | 2 +- adapters/yieldone/yieldone.go | 2 +- adapters/zeroclickfraud/zeroclickfraud.go | 2 +- adapters/zeta_global_ssp/zeta_global_ssp.go | 2 +- adapters/zmaticoo/zmaticoo.go | 5 +- adservertargeting/adservertargeting.go | 2 +- adservertargeting/adservertargeting_test.go | 4 +- adservertargeting/reqcache.go | 2 +- adservertargeting/requestcache_test.go | 2 +- adservertargeting/requestlookup_test.go | 2 +- adservertargeting/respdataprocessor.go | 2 +- adservertargeting/respdataprocessor_test.go | 4 +- amp/parse.go | 2 +- amp/parse_test.go | 2 +- analytics/build/build_test.go | 2 +- analytics/core.go | 2 +- analytics/filesystem/file_module.go | 2 +- analytics/filesystem/file_module_test.go | 2 +- analytics/filesystem/model.go | 2 +- analytics/pubstack/helpers/json.go | 2 +- analytics/pubstack/helpers/json_test.go | 2 +- analytics/pubstack/helpers/model.go | 2 +- bidadjustment/apply_test.go | 2 +- bidadjustment/build_rules_test.go | 2 +- config/config.go | 2 +- endpoints/openrtb2/amp_auction.go | 4 +- endpoints/openrtb2/amp_auction_test.go | 2 +- endpoints/openrtb2/auction.go | 14 +- endpoints/openrtb2/auction_test.go | 6 +- endpoints/openrtb2/interstitial.go | 2 +- endpoints/openrtb2/interstitial_test.go | 2 +- endpoints/openrtb2/test_utils.go | 4 +- endpoints/openrtb2/video_auction.go | 2 +- endpoints/openrtb2/video_auction_test.go | 81 +++-- exchange/adapter_util_test.go | 2 +- exchange/auction.go | 2 +- exchange/auction_response.go | 2 +- exchange/auction_test.go | 2 +- exchange/bidder.go | 8 +- exchange/bidder_test.go | 19 +- exchange/bidder_validate_bids.go | 2 +- exchange/bidder_validate_bids_test.go | 2 +- exchange/entities/entities.go | 2 +- exchange/events_test.go | 2 +- exchange/exchange.go | 4 +- exchange/exchange_test.go | 8 +- exchange/gdpr_test.go | 2 +- exchange/price_granularity.go | 2 +- exchange/price_granularity_test.go | 2 +- exchange/seat_non_bids_test.go | 2 +- exchange/targeting.go | 2 +- exchange/targeting_test.go | 2 +- exchange/utils.go | 9 +- exchange/utils_test.go | 40 +-- firstpartydata/first_party_data.go | 2 +- firstpartydata/first_party_data_test.go | 21 +- floors/enforce.go | 2 +- floors/enforce_test.go | 4 +- floors/floors_test.go | 2 +- floors/rule.go | 7 +- floors/rule_test.go | 21 +- go.mod | 2 +- go.sum | 4 +- hooks/hookexecution/enricher.go | 2 +- hooks/hookexecution/enricher_test.go | 2 +- hooks/hookexecution/execution.go | 11 +- hooks/hookexecution/execution_test.go | 5 +- hooks/hookexecution/executor.go | 2 +- hooks/hookexecution/executor_test.go | 2 +- hooks/hookstage/auctionresponse.go | 2 +- hooks/hookstage/bidderrequest_mutations.go | 3 +- macros/provider_test.go | 2 +- macros/string_index_based_replacer_test.go | 2 +- modules/prebid/ortb2blocking/config.go | 2 +- modules/prebid/ortb2blocking/config_test.go | 2 +- .../ortb2blocking/hook_bidderrequest.go | 4 +- .../ortb2blocking/hook_raw_bidder_response.go | 4 +- modules/prebid/ortb2blocking/module.go | 2 +- modules/prebid/ortb2blocking/module_test.go | 4 +- modules/prebid/ortb2blocking/utils.go | 4 +- openrtb_ext/bid_request_video.go | 2 +- openrtb_ext/convert_down.go | 25 ++ openrtb_ext/convert_down_test.go | 66 +++- openrtb_ext/convert_up.go | 2 +- openrtb_ext/convert_up_test.go | 2 +- openrtb_ext/deal_tier.go | 2 +- openrtb_ext/deal_tier_test.go | 2 +- openrtb_ext/request.go | 2 +- openrtb_ext/request_test.go | 2 +- openrtb_ext/request_wrapper.go | 2 +- openrtb_ext/request_wrapper_test.go | 2 +- openrtb_ext/response.go | 7 +- openrtb_ext/source.go | 2 +- openrtb_ext/supplyChain.go | 2 +- openrtb_ext/supplyChain_test.go | 2 +- openrtb_ext/user.go | 2 +- ortb/clone.go | 79 ++-- ortb/clone_test.go | 115 +++--- ortb/default_test.go | 2 +- privacy/ccpa/consentwriter.go | 2 +- privacy/ccpa/consentwriter_test.go | 2 +- privacy/ccpa/policy.go | 2 +- privacy/ccpa/policy_test.go | 2 +- privacy/gdpr/consentwriter.go | 2 +- privacy/gdpr/consentwriter_test.go | 2 +- privacy/lmt/ios.go | 2 +- privacy/lmt/ios_test.go | 2 +- privacy/lmt/policy.go | 2 +- privacy/lmt/policy_test.go | 2 +- privacy/rule_condition_test.go | 2 +- privacy/scrubber.go | 20 +- privacy/scrubber_test.go | 39 +- privacy/writer.go | 2 +- privacy/writer_test.go | 2 +- schain/schain.go | 2 +- schain/schain_test.go | 2 +- schain/schainwriter.go | 2 +- schain/schainwriter_test.go | 7 +- stored_responses/stored_responses.go | 2 +- stored_responses/stored_responses_test.go | 2 +- util/ptrutil/ptrutil.go | 9 + util/ptrutil/ptrutil_test.go | 45 +++ version/xprebidheader.go | 2 +- version/xprebidheader_test.go | 2 +- 358 files changed, 2664 insertions(+), 719 deletions(-) create mode 100644 adapters/33across/33acrosstest/supplemental/video-validation-fail-size-null.json create mode 100644 adapters/33across/33acrosstest/supplemental/video-validation-fail-size-partial.json create mode 100644 adapters/33across/33acrosstest/supplemental/video-validation-fail-size-zero.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/adm-video-no-size.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/adm-video-partial-size.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/adm-video-zero-size-partial.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/adm-video-zero-size.json create mode 100644 adapters/cadent_aperture_mx/cadent_aperture_mxtest/supplemental/bad-imp-video-missing-partial-sizes.json create mode 100644 adapters/cadent_aperture_mx/cadent_aperture_mxtest/supplemental/bad-imp-video-zero-sizes.json create mode 100644 adapters/eplanning/eplanningtest/supplemental/video-partial-size-send-640x480.json create mode 100644 adapters/eplanning/eplanningtest/supplemental/video-zero-size-send-640x480.json create mode 100644 adapters/gumgum/gumgumtest/supplemental/video-missing-size.json create mode 100644 adapters/gumgum/gumgumtest/supplemental/video-partial-size.json create mode 100644 adapters/gumgum/gumgumtest/supplemental/video-zero-size.json create mode 100644 adapters/huaweiads/huaweiadstest/supplemental/missing_video_size.json create mode 100644 adapters/huaweiads/huaweiadstest/supplemental/zero_video_size.json create mode 100644 adapters/richaudience/richaudiencetest/supplemental/videoSizePartial.json create mode 100644 adapters/richaudience/richaudiencetest/supplemental/videoSizeZero.json create mode 100644 util/ptrutil/ptrutil_test.go diff --git a/adapters/33across/33across.go b/adapters/33across/33across.go index c7c3300a648..b9062468a73 100644 --- a/adapters/33across/33across.go +++ b/adapters/33across/33across.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" @@ -243,8 +243,8 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequ func validateVideoParams(video *openrtb2.Video, prod string) (*openrtb2.Video, error) { videoCopy := *video - if videoCopy.W == 0 || - videoCopy.H == 0 || + if (videoCopy.W == nil || *videoCopy.W == 0) || + (videoCopy.H == nil || *videoCopy.H == 0) || videoCopy.Protocols == nil || videoCopy.MIMEs == nil || videoCopy.PlaybackMethod == nil { diff --git a/adapters/33across/33acrosstest/supplemental/video-validation-fail-size-null.json b/adapters/33across/33acrosstest/supplemental/video-validation-fail-size-null.json new file mode 100644 index 00000000000..c9389fb86c2 --- /dev/null +++ b/adapters/33across/33acrosstest/supplemental/video-validation-fail-size-null.json @@ -0,0 +1,29 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "protocols": [2], + "playbackmethod": [2], + "mimes": ["foo", "bar"] + }, + "ext": { + "bidder": { + "siteId": "fake-site-id", + "productId": "siab" + } + } + } + ], + "site": {} + }, + + "expectedMakeRequestsErrors": [ + { + "value": "One or more invalid or missing video field(s) w, h, protocols, mimes, playbackmethod", + "comparison": "literal" + } + ] +} diff --git a/adapters/33across/33acrosstest/supplemental/video-validation-fail-size-partial.json b/adapters/33across/33acrosstest/supplemental/video-validation-fail-size-partial.json new file mode 100644 index 00000000000..230eaac05df --- /dev/null +++ b/adapters/33across/33acrosstest/supplemental/video-validation-fail-size-partial.json @@ -0,0 +1,30 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "h": 100, + "protocols": [2], + "playbackmethod": [2], + "mimes": ["foo", "bar"] + }, + "ext": { + "bidder": { + "siteId": "fake-site-id", + "productId": "siab" + } + } + } + ], + "site": {} + }, + + "expectedMakeRequestsErrors": [ + { + "value": "One or more invalid or missing video field(s) w, h, protocols, mimes, playbackmethod", + "comparison": "literal" + } + ] +} diff --git a/adapters/33across/33acrosstest/supplemental/video-validation-fail-size-zero.json b/adapters/33across/33acrosstest/supplemental/video-validation-fail-size-zero.json new file mode 100644 index 00000000000..32927e2b455 --- /dev/null +++ b/adapters/33across/33acrosstest/supplemental/video-validation-fail-size-zero.json @@ -0,0 +1,31 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "w": 0, + "h": 0, + "protocols": [2], + "playbackmethod": [2], + "mimes": ["foo", "bar"] + }, + "ext": { + "bidder": { + "siteId": "fake-site-id", + "productId": "siab" + } + } + } + ], + "site": {} + }, + + "expectedMakeRequestsErrors": [ + { + "value": "One or more invalid or missing video field(s) w, h, protocols, mimes, playbackmethod", + "comparison": "literal" + } + ] +} diff --git a/adapters/aax/aax.go b/adapters/aax/aax.go index a36bf3ad37e..2ad39b1446b 100644 --- a/adapters/aax/aax.go +++ b/adapters/aax/aax.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/aceex/aceex.go b/adapters/aceex/aceex.go index a87a2b11fcf..450d82b4df3 100644 --- a/adapters/aceex/aceex.go +++ b/adapters/aceex/aceex.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/acuityads/acuityads.go b/adapters/acuityads/acuityads.go index 9152e80b83f..183f1168d9f 100644 --- a/adapters/acuityads/acuityads.go +++ b/adapters/acuityads/acuityads.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adapterstest/adapter_test_util.go b/adapters/adapterstest/adapter_test_util.go index 46527356fe2..d58437b8fd8 100644 --- a/adapters/adapterstest/adapter_test_util.go +++ b/adapters/adapterstest/adapter_test_util.go @@ -8,7 +8,7 @@ import ( "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) // OrtbMockService Represents a scaffolded OpenRTB service. diff --git a/adapters/adapterstest/test_json.go b/adapters/adapterstest/test_json.go index d14ff015ced..5b6c56d2cee 100644 --- a/adapters/adapterstest/test_json.go +++ b/adapters/adapterstest/test_json.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/mitchellh/copystructure" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/currency" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/adf/adf.go b/adapters/adf/adf.go index 0f14a05e947..4b6ff2b76c7 100644 --- a/adapters/adf/adf.go +++ b/adapters/adf/adf.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adgeneration/adgeneration.go b/adapters/adgeneration/adgeneration.go index 88166ec237d..92ea0c3adc8 100644 --- a/adapters/adgeneration/adgeneration.go +++ b/adapters/adgeneration/adgeneration.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adgeneration/adgeneration_test.go b/adapters/adgeneration/adgeneration_test.go index 3e94ac6c382..802db77e313 100644 --- a/adapters/adgeneration/adgeneration_test.go +++ b/adapters/adgeneration/adgeneration_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/adhese/adhese.go b/adapters/adhese/adhese.go index 29c21ef3b99..f27848f023d 100644 --- a/adapters/adhese/adhese.go +++ b/adapters/adhese/adhese.go @@ -10,7 +10,7 @@ import ( "strings" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adhese/utils.go b/adapters/adhese/utils.go index 4a6c79c8e94..a6b7d7aae8d 100644 --- a/adapters/adhese/utils.go +++ b/adapters/adhese/utils.go @@ -1,6 +1,6 @@ package adhese -import "github.com/prebid/openrtb/v19/openrtb2" +import "github.com/prebid/openrtb/v20/openrtb2" type AdheseOriginData struct { Priority string `json:"priority"` diff --git a/adapters/adkernel/adkernel.go b/adapters/adkernel/adkernel.go index 11ab006d89e..09a2358a951 100644 --- a/adapters/adkernel/adkernel.go +++ b/adapters/adkernel/adkernel.go @@ -8,7 +8,7 @@ import ( "strings" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adkernelAdn/adkernelAdn.go b/adapters/adkernelAdn/adkernelAdn.go index 218708cb697..a6255f89820 100644 --- a/adapters/adkernelAdn/adkernelAdn.go +++ b/adapters/adkernelAdn/adkernelAdn.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adman/adman.go b/adapters/adman/adman.go index 48a4dff961c..6611e0cdee8 100644 --- a/adapters/adman/adman.go +++ b/adapters/adman/adman.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/admixer/admixer.go b/adapters/admixer/admixer.go index 5c68518ee52..b0f8b1b2e56 100644 --- a/adapters/admixer/admixer.go +++ b/adapters/admixer/admixer.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adnuntius/adnuntius.go b/adapters/adnuntius/adnuntius.go index cb8d876fb53..4b823455815 100644 --- a/adapters/adnuntius/adnuntius.go +++ b/adapters/adnuntius/adnuntius.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adocean/adocean.go b/adapters/adocean/adocean.go index aa9446d76f0..778a6f60a6b 100644 --- a/adapters/adocean/adocean.go +++ b/adapters/adocean/adocean.go @@ -13,7 +13,7 @@ import ( "strings" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adoppler/adoppler.go b/adapters/adoppler/adoppler.go index 42661206ea6..07cfce53c74 100644 --- a/adapters/adoppler/adoppler.go +++ b/adapters/adoppler/adoppler.go @@ -8,7 +8,7 @@ import ( "net/url" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adot/adot.go b/adapters/adot/adot.go index 39c665b4f12..a0274c29ddf 100644 --- a/adapters/adot/adot.go +++ b/adapters/adot/adot.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adot/adot_test.go b/adapters/adot/adot_test.go index 1d2de9fa8ea..236287fffa0 100644 --- a/adapters/adot/adot_test.go +++ b/adapters/adot/adot_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/adpone/adpone.go b/adapters/adpone/adpone.go index 77c7c8e0858..f5c9121e86d 100644 --- a/adapters/adpone/adpone.go +++ b/adapters/adpone/adpone.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/adprime/adprime.go b/adapters/adprime/adprime.go index 56193c9133b..fe5f640ed6c 100644 --- a/adapters/adprime/adprime.go +++ b/adapters/adprime/adprime.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adquery/adquery.go b/adapters/adquery/adquery.go index a1e8f638d7f..4da3f7a459e 100644 --- a/adapters/adquery/adquery.go +++ b/adapters/adquery/adquery.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adrino/adrino.go b/adapters/adrino/adrino.go index 44de44f5cf8..4510285adc0 100644 --- a/adapters/adrino/adrino.go +++ b/adapters/adrino/adrino.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adsinteractive/adsinteractive.go b/adapters/adsinteractive/adsinteractive.go index d50dad0aabd..b7dc9fd041f 100644 --- a/adapters/adsinteractive/adsinteractive.go +++ b/adapters/adsinteractive/adsinteractive.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adtarget/adtarget.go b/adapters/adtarget/adtarget.go index ccd362830fc..54f25205790 100644 --- a/adapters/adtarget/adtarget.go +++ b/adapters/adtarget/adtarget.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adtelligent/adtelligent.go b/adapters/adtelligent/adtelligent.go index 281d79233a0..45d4d291c4e 100644 --- a/adapters/adtelligent/adtelligent.go +++ b/adapters/adtelligent/adtelligent.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adtrgtme/adtrgtme.go b/adapters/adtrgtme/adtrgtme.go index 47feaceefa7..e0a724146fa 100644 --- a/adapters/adtrgtme/adtrgtme.go +++ b/adapters/adtrgtme/adtrgtme.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/advangelists/advangelists.go b/adapters/advangelists/advangelists.go index c779483d64a..fc23973f040 100644 --- a/adapters/advangelists/advangelists.go +++ b/adapters/advangelists/advangelists.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adview/adview.go b/adapters/adview/adview.go index 9937b6ae3ee..88a236dc87f 100644 --- a/adapters/adview/adview.go +++ b/adapters/adview/adview.go @@ -7,7 +7,7 @@ import ( "strings" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adxcg/adxcg.go b/adapters/adxcg/adxcg.go index a8cb380f6c0..6c1a4f78b2b 100644 --- a/adapters/adxcg/adxcg.go +++ b/adapters/adxcg/adxcg.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/adyoulike/adyoulike.go b/adapters/adyoulike/adyoulike.go index 72e6612b675..d1d05f6b3de 100644 --- a/adapters/adyoulike/adyoulike.go +++ b/adapters/adyoulike/adyoulike.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/aidem/aidem.go b/adapters/aidem/aidem.go index 79238c1b234..b50f5a7db61 100644 --- a/adapters/aidem/aidem.go +++ b/adapters/aidem/aidem.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/aja/aja.go b/adapters/aja/aja.go index 178c7f6ca68..edf9f316d4d 100644 --- a/adapters/aja/aja.go +++ b/adapters/aja/aja.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/algorix/algorix.go b/adapters/algorix/algorix.go index e646467f744..d6b1ea074fa 100644 --- a/adapters/algorix/algorix.go +++ b/adapters/algorix/algorix.go @@ -7,7 +7,7 @@ import ( "net/url" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/alkimi/alkimi.go b/adapters/alkimi/alkimi.go index f0979c3a809..4fe0cdefc8f 100644 --- a/adapters/alkimi/alkimi.go +++ b/adapters/alkimi/alkimi.go @@ -3,14 +3,15 @@ package alkimi import ( "encoding/json" "fmt" - "github.com/prebid/prebid-server/v2/errortypes" - "github.com/prebid/prebid-server/v2/floors" "net/http" "net/url" "strconv" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/prebid-server/v2/errortypes" + "github.com/prebid/prebid-server/v2/floors" + + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/amx/amx.go b/adapters/amx/amx.go index 8ff30baef79..73b75e7d9db 100644 --- a/adapters/amx/amx.go +++ b/adapters/amx/amx.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/amx/amx_test.go b/adapters/amx/amx_test.go index 7286f221997..d8c73a6141f 100644 --- a/adapters/amx/amx_test.go +++ b/adapters/amx/amx_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/apacdex/apacdex.go b/adapters/apacdex/apacdex.go index ee10247638c..35ba3a04b4f 100644 --- a/adapters/apacdex/apacdex.go +++ b/adapters/apacdex/apacdex.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/appnexus/appnexus.go b/adapters/appnexus/appnexus.go index ad3be2dbb2d..10a8d825d7a 100644 --- a/adapters/appnexus/appnexus.go +++ b/adapters/appnexus/appnexus.go @@ -10,8 +10,8 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/util/maputil" "github.com/prebid/prebid-server/v2/util/ptrutil" diff --git a/adapters/appush/appush.go b/adapters/appush/appush.go index 36eccef0a0c..bbbbc871360 100644 --- a/adapters/appush/appush.go +++ b/adapters/appush/appush.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/audienceNetwork/facebook.go b/adapters/audienceNetwork/facebook.go index 8a288bb0338..ebd72938f03 100644 --- a/adapters/audienceNetwork/facebook.go +++ b/adapters/audienceNetwork/facebook.go @@ -11,7 +11,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" @@ -19,6 +19,7 @@ import ( "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/jsonutil" "github.com/prebid/prebid-server/v2/util/maputil" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) var supportedBannerHeights = map[int64]struct{}{ @@ -26,8 +27,8 @@ var supportedBannerHeights = map[int64]struct{}{ 250: {}, } -type FacebookAdapter struct { - URI string +type adapter struct { + uri string platformID string appSecret string } @@ -41,7 +42,7 @@ type facebookReqExt struct { AuthID string `json:"authentication_id"` } -func (this *FacebookAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ Message: "No impressions provided", @@ -60,10 +61,10 @@ func (this *FacebookAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo }} } - return this.buildRequests(request) + return a.buildRequests(request) } -func (this *FacebookAdapter) buildRequests(request *openrtb2.BidRequest) ([]*adapters.RequestData, []error) { +func (a *adapter) buildRequests(request *openrtb2.BidRequest) ([]*adapters.RequestData, []error) { // Documentation suggests bid request splitting by impression so that each // request only represents a single impression reqs := make([]*adapters.RequestData, 0, len(request.Imp)) @@ -80,7 +81,7 @@ func (this *FacebookAdapter) buildRequests(request *openrtb2.BidRequest) ([]*ada fbreq := *request fbreq.Imp = []openrtb2.Imp{imp} - if err := this.modifyRequest(&fbreq); err != nil { + if err := a.modifyRequest(&fbreq); err != nil { errs = append(errs, err) continue } @@ -105,7 +106,7 @@ func (this *FacebookAdapter) buildRequests(request *openrtb2.BidRequest) ([]*ada reqs = append(reqs, &adapters.RequestData{ Method: "POST", - Uri: this.URI, + Uri: a.uri, Body: body, Headers: headers, }) @@ -116,20 +117,20 @@ func (this *FacebookAdapter) buildRequests(request *openrtb2.BidRequest) ([]*ada // The authentication ID is a sha256 hmac hash encoded as a hex string, based on // the app secret and the ID of the bid request -func (this *FacebookAdapter) makeAuthID(req *openrtb2.BidRequest) string { - h := hmac.New(sha256.New, []byte(this.appSecret)) +func (a *adapter) makeAuthID(req *openrtb2.BidRequest) string { + h := hmac.New(sha256.New, []byte(a.appSecret)) h.Write([]byte(req.ID)) return hex.EncodeToString(h.Sum(nil)) } -func (this *FacebookAdapter) modifyRequest(out *openrtb2.BidRequest) error { +func (a *adapter) modifyRequest(out *openrtb2.BidRequest) error { if len(out.Imp) != 1 { panic("each bid request to facebook should only have a single impression") } imp := &out.Imp[0] - plmtId, pubId, err := this.extractPlacementAndPublisher(imp) + plmtId, pubId, err := extractPlacementAndPublisher(imp) if err != nil { return err } @@ -140,8 +141,8 @@ func (this *FacebookAdapter) modifyRequest(out *openrtb2.BidRequest) error { out.ID = imp.ID reqExt := facebookReqExt{ - PlatformID: this.platformID, - AuthID: this.makeAuthID(out), + PlatformID: a.platformID, + AuthID: a.makeAuthID(out), } if out.Ext, err = json.Marshal(reqExt); err != nil { @@ -157,14 +158,14 @@ func (this *FacebookAdapter) modifyRequest(out *openrtb2.BidRequest) error { out.App = &app } - if err = this.modifyImp(imp); err != nil { + if err = modifyImp(imp); err != nil { return err } return nil } -func (this *FacebookAdapter) modifyImp(out *openrtb2.Imp) error { +func modifyImp(out *openrtb2.Imp) error { impType := resolveImpType(out) if out.Instl == 1 && impType != openrtb_ext.BidTypeBanner { @@ -178,8 +179,8 @@ func (this *FacebookAdapter) modifyImp(out *openrtb2.Imp) error { out.Banner = &bannerCopy if out.Instl == 1 { - out.Banner.W = openrtb2.Int64Ptr(0) - out.Banner.H = openrtb2.Int64Ptr(0) + out.Banner.W = ptrutil.ToPtr[int64](0) + out.Banner.H = ptrutil.ToPtr[int64](0) out.Banner.Format = nil return nil } @@ -205,14 +206,14 @@ func (this *FacebookAdapter) modifyImp(out *openrtb2.Imp) error { } } - out.Banner.W = openrtb2.Int64Ptr(-1) + out.Banner.W = ptrutil.ToPtr[int64](-1) out.Banner.Format = nil } return nil } -func (this *FacebookAdapter) extractPlacementAndPublisher(out *openrtb2.Imp) (string, string, error) { +func extractPlacementAndPublisher(out *openrtb2.Imp) (string, string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(out.Ext, &bidderExt); err != nil { return "", "", &errortypes.BadInput{ @@ -323,7 +324,7 @@ func modifyImpCustom(jsonData []byte, imp *openrtb2.Imp) ([]byte, error) { } } -func (this *FacebookAdapter) MakeBids(request *openrtb2.BidRequest, adapterRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(request *openrtb2.BidRequest, adapterRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -423,15 +424,15 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co return nil, errors.New("AppSecret is not configured. Did you set adapters.facebook.app_secret in the app config?") } - bidder := &FacebookAdapter{ - URI: config.Endpoint, + bidder := &adapter{ + uri: config.Endpoint, platformID: config.PlatformID, appSecret: config.AppSecret, } return bidder, nil } -func (fa *FacebookAdapter) MakeTimeoutNotification(req *adapters.RequestData) (*adapters.RequestData, []error) { +func (a *adapter) MakeTimeoutNotification(req *adapters.RequestData) (*adapters.RequestData, []error) { var ( rID string pubID string @@ -454,7 +455,7 @@ func (fa *FacebookAdapter) MakeTimeoutNotification(req *adapters.RequestData) (* } } - uri := fmt.Sprintf("https://www.facebook.com/audiencenetwork/nurl/?partner=%s&app=%s&auction=%s&ortb_loss_code=2", fa.platformID, pubID, rID) + uri := fmt.Sprintf("https://www.facebook.com/audiencenetwork/nurl/?partner=%s&app=%s&auction=%s&ortb_loss_code=2", a.platformID, pubID, rID) timeoutReq := adapters.RequestData{ Method: "GET", Uri: uri, diff --git a/adapters/automatad/automatad.go b/adapters/automatad/automatad.go index 3f74d290245..50dd2b79566 100644 --- a/adapters/automatad/automatad.go +++ b/adapters/automatad/automatad.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/avocet/avocet.go b/adapters/avocet/avocet.go index b50b626792e..c922f32da64 100644 --- a/adapters/avocet/avocet.go +++ b/adapters/avocet/avocet.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/avocet/avocet_test.go b/adapters/avocet/avocet_test.go index a7e01cdb65d..7d1295e09d8 100644 --- a/adapters/avocet/avocet_test.go +++ b/adapters/avocet/avocet_test.go @@ -6,8 +6,8 @@ import ( "reflect" "testing" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/axis/axis.go b/adapters/axis/axis.go index afda6045a1e..6d7658eb99e 100644 --- a/adapters/axis/axis.go +++ b/adapters/axis/axis.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/axonix/axonix.go b/adapters/axonix/axonix.go index d5d0b0a41ee..2c29cc258a4 100644 --- a/adapters/axonix/axonix.go +++ b/adapters/axonix/axonix.go @@ -9,7 +9,7 @@ import ( "strings" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/beachfront/beachfront.go b/adapters/beachfront/beachfront.go index 2eba35b91cb..326b4f31091 100644 --- a/adapters/beachfront/beachfront.go +++ b/adapters/beachfront/beachfront.go @@ -8,12 +8,13 @@ import ( "strconv" "strings" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) const Seat = "beachfront" @@ -475,9 +476,20 @@ func getVideoRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraReque } } - if imp.Video.H == 0 && imp.Video.W == 0 { - imp.Video.W = defaultVideoWidth - imp.Video.H = defaultVideoHeight + wNilOrZero := imp.Video.W == nil || *imp.Video.W == 0 + hNilOrZero := imp.Video.H == nil || *imp.Video.H == 0 + if wNilOrZero || hNilOrZero { + videoCopy := *imp.Video + + if wNilOrZero { + videoCopy.W = ptrutil.ToPtr[int64](defaultVideoWidth) + } + + if hNilOrZero { + videoCopy.H = ptrutil.ToPtr[int64](defaultVideoHeight) + } + + imp.Video = &videoCopy } if len(bfReqs[i].Request.Cur) == 0 { @@ -672,8 +684,8 @@ func postprocessVideo(bids []openrtb2.Bid, xtrnal openrtb2.BidRequest, uri strin bids[i].CrID = crid bids[i].ImpID = xtrnal.Imp[i].ID - bids[i].H = xtrnal.Imp[i].Video.H - bids[i].W = xtrnal.Imp[i].Video.W + bids[i].H = ptrutil.ValueOrDefault(xtrnal.Imp[i].Video.H) + bids[i].W = ptrutil.ValueOrDefault(xtrnal.Imp[i].Video.W) bids[i].ID = fmt.Sprintf("%sNurlVideo", xtrnal.Imp[i].ID) } diff --git a/adapters/beachfront/beachfronttest/supplemental/adm-video-no-size.json b/adapters/beachfront/beachfronttest/supplemental/adm-video-no-size.json new file mode 100644 index 00000000000..a84e6c9199b --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/adm-video-no-size.json @@ -0,0 +1,124 @@ +{ + "mockBidRequest": { + "id": "adm-video", + "imp": [ + { + "id": "video1", + "ext": { + "bidder": { + "appId": "videoAppId1" + } + }, + "video": { + "mimes": [ + "video/mp4" + ], + "context": "instream" + } + } + ], + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "device": { + "ip": "192.168.168.168" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/bid.json?exchange_id=videoAppId1", + "body": { + "id": "adm-video", + "imp": [ + { + "video": { + "mimes": [ + "video/mp4" + ], + "w": 300, + "h": 250 + }, + "id": "video1", + "secure": 1 + } + ], + "site": { + "page": "https://some.domain.us/some/page.html", + "domain": "some.domain.us" + }, + "cur": [ + "USD" + ], + "device": { + "devicetype": 2, + "ip": "192.168.168.168" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "adm-video", + "seatBid": [ + { + "bid": [ + { + "id": "5fd7c8a6ff2f1f0d42ee6427", + "impid": "video1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cat": [ + "IAB2" + ], + "cid": "277", + "crid": "532", + "w": 300, + "h": 250, + "ext": { + "duration": 30 + } + } + ], + "seat": "bfio-s-1" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "video1AdmVideo", + "impid": "video1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cid": "277", + "crid": "532", + "cat": [ + "IAB2" + ], + "w": 300, + "h": 250, + "ext": { + "duration": 30 + } + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/beachfront/beachfronttest/supplemental/adm-video-partial-size.json b/adapters/beachfront/beachfronttest/supplemental/adm-video-partial-size.json new file mode 100644 index 00000000000..07ccfcf3401 --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/adm-video-partial-size.json @@ -0,0 +1,125 @@ +{ + "mockBidRequest": { + "id": "adm-video", + "imp": [ + { + "id": "video1", + "ext": { + "bidder": { + "appId": "videoAppId1" + } + }, + "video": { + "mimes": [ + "video/mp4" + ], + "w": 100, + "context": "instream" + } + } + ], + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "device": { + "ip": "192.168.168.168" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/bid.json?exchange_id=videoAppId1", + "body": { + "id": "adm-video", + "imp": [ + { + "video": { + "mimes": [ + "video/mp4" + ], + "w": 100, + "h": 250 + }, + "id": "video1", + "secure": 1 + } + ], + "site": { + "page": "https://some.domain.us/some/page.html", + "domain": "some.domain.us" + }, + "cur": [ + "USD" + ], + "device": { + "devicetype": 2, + "ip": "192.168.168.168" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "adm-video", + "seatBid": [ + { + "bid": [ + { + "id": "5fd7c8a6ff2f1f0d42ee6427", + "impid": "video1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cat": [ + "IAB2" + ], + "cid": "277", + "crid": "532", + "w": 100, + "h": 250, + "ext": { + "duration": 30 + } + } + ], + "seat": "bfio-s-1" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "video1AdmVideo", + "impid": "video1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cid": "277", + "crid": "532", + "cat": [ + "IAB2" + ], + "w": 100, + "h": 250, + "ext": { + "duration": 30 + } + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/beachfront/beachfronttest/supplemental/adm-video-zero-size-partial.json b/adapters/beachfront/beachfronttest/supplemental/adm-video-zero-size-partial.json new file mode 100644 index 00000000000..f4ce178e980 --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/adm-video-zero-size-partial.json @@ -0,0 +1,126 @@ +{ + "mockBidRequest": { + "id": "adm-video", + "imp": [ + { + "id": "video1", + "ext": { + "bidder": { + "appId": "videoAppId1" + } + }, + "video": { + "mimes": [ + "video/mp4" + ], + "w": 100, + "h": 0, + "context": "instream" + } + } + ], + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "device": { + "ip": "192.168.168.168" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/bid.json?exchange_id=videoAppId1", + "body": { + "id": "adm-video", + "imp": [ + { + "video": { + "mimes": [ + "video/mp4" + ], + "w": 100, + "h": 250 + }, + "id": "video1", + "secure": 1 + } + ], + "site": { + "page": "https://some.domain.us/some/page.html", + "domain": "some.domain.us" + }, + "cur": [ + "USD" + ], + "device": { + "devicetype": 2, + "ip": "192.168.168.168" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "adm-video", + "seatBid": [ + { + "bid": [ + { + "id": "5fd7c8a6ff2f1f0d42ee6427", + "impid": "video1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cat": [ + "IAB2" + ], + "cid": "277", + "crid": "532", + "w": 300, + "h": 250, + "ext": { + "duration": 30 + } + } + ], + "seat": "bfio-s-1" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "video1AdmVideo", + "impid": "video1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cid": "277", + "crid": "532", + "cat": [ + "IAB2" + ], + "w": 300, + "h": 250, + "ext": { + "duration": 30 + } + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/beachfront/beachfronttest/supplemental/adm-video-zero-size.json b/adapters/beachfront/beachfronttest/supplemental/adm-video-zero-size.json new file mode 100644 index 00000000000..cf0a4e6daa6 --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/adm-video-zero-size.json @@ -0,0 +1,126 @@ +{ + "mockBidRequest": { + "id": "adm-video", + "imp": [ + { + "id": "video1", + "ext": { + "bidder": { + "appId": "videoAppId1" + } + }, + "video": { + "mimes": [ + "video/mp4" + ], + "w": 0, + "h": 0, + "context": "instream" + } + } + ], + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "device": { + "ip": "192.168.168.168" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/bid.json?exchange_id=videoAppId1", + "body": { + "id": "adm-video", + "imp": [ + { + "video": { + "mimes": [ + "video/mp4" + ], + "w": 300, + "h": 250 + }, + "id": "video1", + "secure": 1 + } + ], + "site": { + "page": "https://some.domain.us/some/page.html", + "domain": "some.domain.us" + }, + "cur": [ + "USD" + ], + "device": { + "devicetype": 2, + "ip": "192.168.168.168" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "adm-video", + "seatBid": [ + { + "bid": [ + { + "id": "5fd7c8a6ff2f1f0d42ee6427", + "impid": "video1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cat": [ + "IAB2" + ], + "cid": "277", + "crid": "532", + "w": 300, + "h": 250, + "ext": { + "duration": 30 + } + } + ], + "seat": "bfio-s-1" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "video1AdmVideo", + "impid": "video1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cid": "277", + "crid": "532", + "cat": [ + "IAB2" + ], + "w": 300, + "h": 250, + "ext": { + "duration": 30 + } + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/beintoo/beintoo.go b/adapters/beintoo/beintoo.go index b4e7626a6f6..5b2cbfcbb2a 100644 --- a/adapters/beintoo/beintoo.go +++ b/adapters/beintoo/beintoo.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/bematterfull/bematterfull.go b/adapters/bematterfull/bematterfull.go index 61b98d771ba..c1b4a9c4381 100644 --- a/adapters/bematterfull/bematterfull.go +++ b/adapters/bematterfull/bematterfull.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/between/between.go b/adapters/between/between.go index 9629f747657..25ac3f0dd57 100644 --- a/adapters/between/between.go +++ b/adapters/between/between.go @@ -8,7 +8,7 @@ import ( "strconv" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/beyondmedia/beyondmedia.go b/adapters/beyondmedia/beyondmedia.go index 50091aba03b..3fbaa66b613 100644 --- a/adapters/beyondmedia/beyondmedia.go +++ b/adapters/beyondmedia/beyondmedia.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/bidder.go b/adapters/bidder.go index b56f02e5156..2bbcb65701c 100644 --- a/adapters/bidder.go +++ b/adapters/bidder.go @@ -5,7 +5,7 @@ import ( "encoding/json" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/currency" "github.com/prebid/prebid-server/v2/metrics" diff --git a/adapters/bidmachine/bidmachine.go b/adapters/bidmachine/bidmachine.go index da46a784625..0744d6131c4 100644 --- a/adapters/bidmachine/bidmachine.go +++ b/adapters/bidmachine/bidmachine.go @@ -9,8 +9,8 @@ import ( "strconv" "text/template" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/bidmyadz/bidmyadz.go b/adapters/bidmyadz/bidmyadz.go index 55b2da54e44..74e71df3b23 100644 --- a/adapters/bidmyadz/bidmyadz.go +++ b/adapters/bidmyadz/bidmyadz.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/bidscube/bidscube.go b/adapters/bidscube/bidscube.go index a1bd72c171b..73c842b87f9 100644 --- a/adapters/bidscube/bidscube.go +++ b/adapters/bidscube/bidscube.go @@ -8,7 +8,7 @@ import ( "strconv" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/bidstack/bidstack.go b/adapters/bidstack/bidstack.go index a88b503a0f8..01586f50bb3 100644 --- a/adapters/bidstack/bidstack.go +++ b/adapters/bidstack/bidstack.go @@ -7,7 +7,7 @@ import ( "net/http" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/bidstack/bidstack_test.go b/adapters/bidstack/bidstack_test.go index d6050bdad96..3c160583729 100644 --- a/adapters/bidstack/bidstack_test.go +++ b/adapters/bidstack/bidstack_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" "github.com/prebid/prebid-server/v2/adapters/adapterstest" diff --git a/adapters/bizzclick/bizzclick.go b/adapters/bizzclick/bizzclick.go index 4f16268cd05..b869a5f7a69 100644 --- a/adapters/bizzclick/bizzclick.go +++ b/adapters/bizzclick/bizzclick.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/bliink/bliink.go b/adapters/bliink/bliink.go index bfd8aeb1dcc..2472d3c72eb 100644 --- a/adapters/bliink/bliink.go +++ b/adapters/bliink/bliink.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/blue/blue.go b/adapters/blue/blue.go index d1743378c0b..481543e4763 100644 --- a/adapters/blue/blue.go +++ b/adapters/blue/blue.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/bluesea/bluesea.go b/adapters/bluesea/bluesea.go index 7d8ff7d92b2..994f8033bf6 100644 --- a/adapters/bluesea/bluesea.go +++ b/adapters/bluesea/bluesea.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/bmtm/brightmountainmedia.go b/adapters/bmtm/brightmountainmedia.go index 90bac4ac8ae..f820254c0ce 100644 --- a/adapters/bmtm/brightmountainmedia.go +++ b/adapters/bmtm/brightmountainmedia.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/boldwin/boldwin.go b/adapters/boldwin/boldwin.go index 9425cd80fbb..1754423f32d 100644 --- a/adapters/boldwin/boldwin.go +++ b/adapters/boldwin/boldwin.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/brave/brave.go b/adapters/brave/brave.go index bde07b66641..2642a2b91c1 100755 --- a/adapters/brave/brave.go +++ b/adapters/brave/brave.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/cadent_aperture_mx/cadent_aperture_mxtest/supplemental/bad-imp-video-missing-partial-sizes.json b/adapters/cadent_aperture_mx/cadent_aperture_mxtest/supplemental/bad-imp-video-missing-partial-sizes.json new file mode 100644 index 00000000000..e3c0a84a173 --- /dev/null +++ b/adapters/cadent_aperture_mx/cadent_aperture_mxtest/supplemental/bad-imp-video-missing-partial-sizes.json @@ -0,0 +1,145 @@ +{ + "mockBidRequest": { + "id": "some_test_auction", + "imp": [ + { + "id": "some_test_ad_id", + "video": { + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "h": 480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + } + } + ], + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 + }, + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Referer": [ + "http://www.publisher.com/awesome/site?with=some¶meters=here" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [ + { + "id": "some_test_ad_id", + "video": { + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "h": 480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 + } + ], + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" + }, + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [ + { + "seat": "12356", + "bid": [ + { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "ttl": 300, + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/cadent_aperture_mx/cadent_aperture_mxtest/supplemental/bad-imp-video-zero-sizes.json b/adapters/cadent_aperture_mx/cadent_aperture_mxtest/supplemental/bad-imp-video-zero-sizes.json new file mode 100644 index 00000000000..851fcd75f0f --- /dev/null +++ b/adapters/cadent_aperture_mx/cadent_aperture_mxtest/supplemental/bad-imp-video-zero-sizes.json @@ -0,0 +1,38 @@ +{ + "mockBidRequest": { + "id": "some_test_auction", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4", + "application/javascript" + ], + "w": 0, + "h": 0 + }, + "ext": { + "bidder": { + "tagid": "12356" + } + } + } + ], + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "Video: Need at least one size to build request", + "comparison": "literal" + }, + { + "value": "Error in preprocess of Imp, err: [Video: Need at least one size to build request]", + "comparison": "literal" + } + ] + } + \ No newline at end of file diff --git a/adapters/cadent_aperture_mx/cadentaperturemx.go b/adapters/cadent_aperture_mx/cadentaperturemx.go index 4b4ccc6b2e4..b7e55d0d80b 100644 --- a/adapters/cadent_aperture_mx/cadentaperturemx.go +++ b/adapters/cadent_aperture_mx/cadentaperturemx.go @@ -9,8 +9,8 @@ import ( "strings" "time" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" @@ -147,7 +147,7 @@ func buildImpVideo(imp *openrtb2.Imp) error { } } - if imp.Video.H == 0 && imp.Video.W == 0 { + if (imp.Video.H == nil || *imp.Video.H == 0) && (imp.Video.W == nil || *imp.Video.W == 0) { return &errortypes.BadInput{ Message: fmt.Sprintf("Video: Need at least one size to build request"), } diff --git a/adapters/ccx/ccx.go b/adapters/ccx/ccx.go index ef5a6a17a9a..ac6ae4f9d0f 100644 --- a/adapters/ccx/ccx.go +++ b/adapters/ccx/ccx.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/coinzilla/coinzilla.go b/adapters/coinzilla/coinzilla.go index bc04758e537..a3de4fa534f 100644 --- a/adapters/coinzilla/coinzilla.go +++ b/adapters/coinzilla/coinzilla.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/colossus/colossus.go b/adapters/colossus/colossus.go index bc9836984ce..649de9b79cd 100644 --- a/adapters/colossus/colossus.go +++ b/adapters/colossus/colossus.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/compass/compass.go b/adapters/compass/compass.go index 3edf9b6f157..ea4886fa5d5 100644 --- a/adapters/compass/compass.go +++ b/adapters/compass/compass.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/connectad/connectad.go b/adapters/connectad/connectad.go index ee2e8eeb699..5bf60106016 100644 --- a/adapters/connectad/connectad.go +++ b/adapters/connectad/connectad.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/consumable/consumable.go b/adapters/consumable/consumable.go index 932a58b5679..94cd7d5fd2d 100644 --- a/adapters/consumable/consumable.go +++ b/adapters/consumable/consumable.go @@ -3,12 +3,14 @@ package consumable import ( "encoding/json" "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "net/http" + "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" - "net/http" + + "github.com/prebid/openrtb/v20/openrtb2" ) type adapter struct { diff --git a/adapters/consumable/consumable_test.go b/adapters/consumable/consumable_test.go index 75e69535f20..f960597cff3 100644 --- a/adapters/consumable/consumable_test.go +++ b/adapters/consumable/consumable_test.go @@ -2,13 +2,15 @@ package consumable import ( "encoding/json" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "testing" + + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" - "testing" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) func TestJsonSamples(t *testing.T) { @@ -29,8 +31,8 @@ func TestConsumableMakeBidsWithCategoryDuration(t *testing.T) { Imp: []openrtb2.Imp{{ ID: "1_1", Video: &openrtb2.Video{ - W: 640, - H: 360, + W: ptrutil.ToPtr[int64](640), + H: ptrutil.ToPtr[int64](360), MIMEs: []string{"video/mp4"}, MaxDuration: 60, Protocols: []adcom1.MediaCreativeSubtype{2, 3, 5, 6}, diff --git a/adapters/conversant/conversant.go b/adapters/conversant/conversant.go index 56ed4b0865c..48d238bebd0 100644 --- a/adapters/conversant/conversant.go +++ b/adapters/conversant/conversant.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/cpmstar/cpmstar.go b/adapters/cpmstar/cpmstar.go index f337c1477c5..9b2c6fd862f 100644 --- a/adapters/cpmstar/cpmstar.go +++ b/adapters/cpmstar/cpmstar.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/criteo/criteo.go b/adapters/criteo/criteo.go index cef79d46756..e08831ad35f 100644 --- a/adapters/criteo/criteo.go +++ b/adapters/criteo/criteo.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/cwire/cwire.go b/adapters/cwire/cwire.go index 0c51fed908d..00c2c373ab4 100644 --- a/adapters/cwire/cwire.go +++ b/adapters/cwire/cwire.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/datablocks/datablocks.go b/adapters/datablocks/datablocks.go index 22bf67bdbbe..6617fb75c48 100644 --- a/adapters/datablocks/datablocks.go +++ b/adapters/datablocks/datablocks.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/decenterads/decenterads.go b/adapters/decenterads/decenterads.go index bf673ee1691..4e69574558e 100644 --- a/adapters/decenterads/decenterads.go +++ b/adapters/decenterads/decenterads.go @@ -7,7 +7,7 @@ import ( "net/http" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/deepintent/deepintent.go b/adapters/deepintent/deepintent.go index 1bda503ae32..0404b33928a 100644 --- a/adapters/deepintent/deepintent.go +++ b/adapters/deepintent/deepintent.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/definemedia/definemedia.go b/adapters/definemedia/definemedia.go index 789902d0485..10478ba14d2 100644 --- a/adapters/definemedia/definemedia.go +++ b/adapters/definemedia/definemedia.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/dianomi/dianomi.go b/adapters/dianomi/dianomi.go index f7b97748c5b..9e770906c51 100644 --- a/adapters/dianomi/dianomi.go +++ b/adapters/dianomi/dianomi.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/dmx/dmx.go b/adapters/dmx/dmx.go index 488c3d46453..b9422c7a152 100644 --- a/adapters/dmx/dmx.go +++ b/adapters/dmx/dmx.go @@ -8,8 +8,8 @@ import ( "net/url" "strings" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/dmx/dmx_test.go b/adapters/dmx/dmx_test.go index c709d5b1617..8d9b2dc6541 100644 --- a/adapters/dmx/dmx_test.go +++ b/adapters/dmx/dmx_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" @@ -377,8 +377,8 @@ func TestMakeBidVideo(t *testing.T) { ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), Video: &openrtb2.Video{ - W: width, - H: height, + W: &width, + H: &height, MIMEs: []string{"video/mp4"}, }} diff --git a/adapters/dxkulture/dxkulture.go b/adapters/dxkulture/dxkulture.go index 8155f59a203..3dc6001f286 100644 --- a/adapters/dxkulture/dxkulture.go +++ b/adapters/dxkulture/dxkulture.go @@ -11,7 +11,7 @@ import ( "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) var markupTypeToBidType = map[openrtb2.MarkupType]openrtb_ext.BidType{ diff --git a/adapters/e_volution/evolution.go b/adapters/e_volution/evolution.go index 4beb488f801..a4c4c6ad36a 100644 --- a/adapters/e_volution/evolution.go +++ b/adapters/e_volution/evolution.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/edge226/edge226.go b/adapters/edge226/edge226.go index 2196006b766..91d6d5c7ad1 100644 --- a/adapters/edge226/edge226.go +++ b/adapters/edge226/edge226.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/emtv/emtv.go b/adapters/emtv/emtv.go index 0f0cae04f1f..d7f1ac03821 100644 --- a/adapters/emtv/emtv.go +++ b/adapters/emtv/emtv.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/eplanning/eplanning.go b/adapters/eplanning/eplanning.go index 16c30296b83..556739c6d24 100644 --- a/adapters/eplanning/eplanning.go +++ b/adapters/eplanning/eplanning.go @@ -11,8 +11,8 @@ import ( "fmt" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" @@ -310,8 +310,8 @@ func searchSizePriority(hashedFormats map[string]int, format []openrtb2.Format, func getSizeFromImp(imp *openrtb2.Imp, isMobile bool) (int64, int64) { - if imp.Video != nil && imp.Video.W > 0 && imp.Video.H > 0 { - return imp.Video.W, imp.Video.H + if imp.Video != nil && imp.Video.W != nil && *imp.Video.W > 0 && imp.Video.H != nil && *imp.Video.H > 0 { + return *imp.Video.W, *imp.Video.H } if imp.Banner != nil { diff --git a/adapters/eplanning/eplanningtest/supplemental/video-partial-size-send-640x480.json b/adapters/eplanning/eplanningtest/supplemental/video-partial-size-send-640x480.json new file mode 100644 index 00000000000..df17f2adfcf --- /dev/null +++ b/adapters/eplanning/eplanningtest/supplemental/video-partial-size-send-640x480.json @@ -0,0 +1,71 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "w": 100 + }, + "ext": { + "bidder": { + "ci": "12345", + "adunit_code": "test_adunitcode_nosize" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://rtb.e-planning.net/pbs/1/12345/1/FILE/ROS?e=video_640x480_0%3A640x480%3B1&ncb=1&ur=FILE&vctx=2&vv=3", + "body": {} + }, + "mockResponse": { + "status": 200, + "body": { + "sI": { "k": "12345" }, + "sec": "ROS", + "sp": [ + { + "k": "video_640x480_0", + "a": [{ + "i": "123456789abcdef", + "pr": "0.5", + "adm": "test", + "crid": "abcdef123456789", + "id": "adid12345", + "w": 640, + "h": 480 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "123456789abcdef", + "impid": "test-imp-id", + "price": 0.5, + "adm": "test", + "adid": "adid12345", + "crid": "abcdef123456789", + "w": 640, + "h": 480 + }, + "type": "video" + } + ] + } + ] + } + diff --git a/adapters/eplanning/eplanningtest/supplemental/video-zero-size-send-640x480.json b/adapters/eplanning/eplanningtest/supplemental/video-zero-size-send-640x480.json new file mode 100644 index 00000000000..6bc28224c16 --- /dev/null +++ b/adapters/eplanning/eplanningtest/supplemental/video-zero-size-send-640x480.json @@ -0,0 +1,72 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "w": 0, + "h": 0 + }, + "ext": { + "bidder": { + "ci": "12345", + "adunit_code": "test_adunitcode_nosize" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://rtb.e-planning.net/pbs/1/12345/1/FILE/ROS?e=video_640x480_0%3A640x480%3B1&ncb=1&ur=FILE&vctx=2&vv=3", + "body": {} + }, + "mockResponse": { + "status": 200, + "body": { + "sI": { "k": "12345" }, + "sec": "ROS", + "sp": [ + { + "k": "video_640x480_0", + "a": [{ + "i": "123456789abcdef", + "pr": "0.5", + "adm": "test", + "crid": "abcdef123456789", + "id": "adid12345", + "w": 640, + "h": 480 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "123456789abcdef", + "impid": "test-imp-id", + "price": 0.5, + "adm": "test", + "adid": "adid12345", + "crid": "abcdef123456789", + "w": 640, + "h": 480 + }, + "type": "video" + } + ] + } + ] + } + diff --git a/adapters/epom/epom.go b/adapters/epom/epom.go index 37ef9543979..d3e5f207236 100644 --- a/adapters/epom/epom.go +++ b/adapters/epom/epom.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/flipp/flipp.go b/adapters/flipp/flipp.go index e758ec741b2..5534981679f 100644 --- a/adapters/flipp/flipp.go +++ b/adapters/flipp/flipp.go @@ -11,7 +11,7 @@ import ( "github.com/buger/jsonparser" "github.com/prebid/go-gdpr/consentconstants" "github.com/prebid/go-gdpr/vendorconsent" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/flipp/flipp_test.go b/adapters/flipp/flipp_test.go index 310b7e145d9..487e1802a85 100644 --- a/adapters/flipp/flipp_test.go +++ b/adapters/flipp/flipp_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/freewheelssp/freewheelssp.go b/adapters/freewheelssp/freewheelssp.go index 1a1738a4ef7..7ee2f76ca04 100644 --- a/adapters/freewheelssp/freewheelssp.go +++ b/adapters/freewheelssp/freewheelssp.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/frvradn/frvradn.go b/adapters/frvradn/frvradn.go index 6781dbc50cf..a25754a18de 100644 --- a/adapters/frvradn/frvradn.go +++ b/adapters/frvradn/frvradn.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/gamma/gamma.go b/adapters/gamma/gamma.go index fac38735507..4564e34244e 100644 --- a/adapters/gamma/gamma.go +++ b/adapters/gamma/gamma.go @@ -7,8 +7,8 @@ import ( "net/url" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" - "github.com/prebid/openrtb/v19/openrtb3" + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/openrtb/v20/openrtb3" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/gamoshi/gamoshi.go b/adapters/gamoshi/gamoshi.go index db066364bf0..7842bf773aa 100644 --- a/adapters/gamoshi/gamoshi.go +++ b/adapters/gamoshi/gamoshi.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/globalsun/globalsun.go b/adapters/globalsun/globalsun.go index 3406f36b704..7bcd418907c 100644 --- a/adapters/globalsun/globalsun.go +++ b/adapters/globalsun/globalsun.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/gothamads/gothamads.go b/adapters/gothamads/gothamads.go index 301a4613677..c5f215333e9 100644 --- a/adapters/gothamads/gothamads.go +++ b/adapters/gothamads/gothamads.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/grid/grid.go b/adapters/grid/grid.go index 0d6bdd76d9b..30180cab89f 100644 --- a/adapters/grid/grid.go +++ b/adapters/grid/grid.go @@ -7,7 +7,7 @@ import ( "sort" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/gumgum/gumgum.go b/adapters/gumgum/gumgum.go index ea9624c73c7..0fb06d3c6bf 100644 --- a/adapters/gumgum/gumgum.go +++ b/adapters/gumgum/gumgum.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" @@ -221,7 +221,7 @@ func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType } func validateVideoParams(video *openrtb2.Video) (err error) { - if video.W == 0 || video.H == 0 || video.MinDuration == 0 || video.MaxDuration == 0 || video.Placement == 0 || video.Linearity == 0 { + if video.W == nil || *video.W == 0 || video.H == nil || *video.H == 0 || video.MinDuration == 0 || video.MaxDuration == 0 || video.Placement == 0 || video.Linearity == 0 { return &errortypes.BadInput{ Message: "Invalid or missing video field(s)", } diff --git a/adapters/gumgum/gumgumtest/supplemental/video-missing-size.json b/adapters/gumgum/gumgumtest/supplemental/video-missing-size.json new file mode 100644 index 00000000000..1e4afe167ea --- /dev/null +++ b/adapters/gumgum/gumgumtest/supplemental/video-missing-size.json @@ -0,0 +1,35 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 1, + "maxduration": 2, + "protocols": [ + 1, + 2 + ], + "startdelay": 1, + "placement": 1, + "linearity": 1 + }, + "ext": { + "bidder": { + "zone": "ggumtest" + } + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "Invalid or missing video field(s)", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/gumgum/gumgumtest/supplemental/video-partial-size.json b/adapters/gumgum/gumgumtest/supplemental/video-partial-size.json new file mode 100644 index 00000000000..3c9727a1a9c --- /dev/null +++ b/adapters/gumgum/gumgumtest/supplemental/video-partial-size.json @@ -0,0 +1,36 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 1, + "maxduration": 2, + "protocols": [ + 1, + 2 + ], + "w": 640, + "startdelay": 1, + "placement": 1, + "linearity": 1 + }, + "ext": { + "bidder": { + "zone": "ggumtest" + } + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "Invalid or missing video field(s)", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/gumgum/gumgumtest/supplemental/video-zero-size.json b/adapters/gumgum/gumgumtest/supplemental/video-zero-size.json new file mode 100644 index 00000000000..d3d4b427120 --- /dev/null +++ b/adapters/gumgum/gumgumtest/supplemental/video-zero-size.json @@ -0,0 +1,37 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 1, + "maxduration": 2, + "protocols": [ + 1, + 2 + ], + "w": 0, + "h": 0, + "startdelay": 1, + "placement": 1, + "linearity": 1 + }, + "ext": { + "bidder": { + "zone": "ggumtest" + } + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "Invalid or missing video field(s)", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/huaweiads/huaweiads.go b/adapters/huaweiads/huaweiads.go index 06ad88f42e6..c1ac451a839 100644 --- a/adapters/huaweiads/huaweiads.go +++ b/adapters/huaweiads/huaweiads.go @@ -16,14 +16,15 @@ import ( "strings" "time" - "github.com/prebid/openrtb/v19/native1" - nativeRequests "github.com/prebid/openrtb/v19/native1/request" - nativeResponse "github.com/prebid/openrtb/v19/native1/response" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/native1" + nativeRequests "github.com/prebid/openrtb/v20/native1/request" + nativeResponse "github.com/prebid/openrtb/v20/native1/response" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) const huaweiAdxApiVersion = "3.4" @@ -566,9 +567,13 @@ func getNativeFormat(adslot30 *adslot30, openRTBImp *openrtb2.Imp) error { if asset.Video != nil { numVideo++ formats = popularSizes - _, ok := sizeMap[format{W: asset.Video.W, H: asset.Video.H}] - if (asset.Video.W != 0 && asset.Video.H != 0) && !ok { - formats = append(formats, format{asset.Video.W, asset.Video.H}) + + w := ptrutil.ValueOrDefault(asset.Video.W) + h := ptrutil.ValueOrDefault(asset.Video.H) + + _, ok := sizeMap[format{W: w, H: h}] + if (w != 0 && h != 0) && !ok { + formats = append(formats, format{w, h}) } } // every image has the same W, H. @@ -624,8 +629,8 @@ func filterPopularSizes(sizes []format, width int64, height int64, byWhat string // roll ad need TotalDuration func getVideoFormat(adslot30 *adslot30, adtype int32, openRTBImp *openrtb2.Imp) error { - adslot30.W = openRTBImp.Video.W - adslot30.H = openRTBImp.Video.H + adslot30.W = ptrutil.ValueOrDefault(openRTBImp.Video.W) + adslot30.H = ptrutil.ValueOrDefault(openRTBImp.Video.H) if adtype == roll { if openRTBImp.Video.MaxDuration == 0 { @@ -935,12 +940,12 @@ func getReqRegsInfo(request *huaweiAdsRequest, openRTBRequest *openrtb2.BidReque // getReqGeoInfo: get geo information for HuaweiAds request, include Lon, Lat, Accuracy, Lastfix func getReqGeoInfo(request *huaweiAdsRequest, openRTBRequest *openrtb2.BidRequest) { if openRTBRequest.Device != nil && openRTBRequest.Device.Geo != nil { - var geo geo - geo.Lon = float32(openRTBRequest.Device.Geo.Lon) - geo.Lat = float32(openRTBRequest.Device.Geo.Lat) - geo.Accuracy = int32(openRTBRequest.Device.Geo.Accuracy) - geo.Lastfix = int32(openRTBRequest.Device.Geo.LastFix) - request.Geo = geo + request.Geo = geo{ + Lon: float32(ptrutil.ValueOrDefault(openRTBRequest.Device.Geo.Lon)), + Lat: float32(ptrutil.ValueOrDefault(openRTBRequest.Device.Geo.Lat)), + Accuracy: int32(openRTBRequest.Device.Geo.Accuracy), + Lastfix: int32(openRTBRequest.Device.Geo.LastFix), + } } } @@ -1444,9 +1449,9 @@ func (a *adapter) extractAdmVideo(adType int32, content *content, bidType openrt adWidth = int64(content.MetaData.VideoInfo.Width) adHeight = int64(content.MetaData.VideoInfo.Height) } else if bidType == openrtb_ext.BidTypeVideo { - if opentrb2Imp.Video != nil && opentrb2Imp.Video.W != 0 && opentrb2Imp.Video.H != 0 { - adWidth = opentrb2Imp.Video.W - adHeight = opentrb2Imp.Video.H + if opentrb2Imp.Video != nil && opentrb2Imp.Video.W != nil && *opentrb2Imp.Video.W != 0 && opentrb2Imp.Video.H != nil && *opentrb2Imp.Video.H != 0 { + adWidth = *opentrb2Imp.Video.W + adHeight = *opentrb2Imp.Video.H } } else { return "", 0, 0, errors.New("extract Adm for video failed: cannot get video width, height") diff --git a/adapters/huaweiads/huaweiadstest/supplemental/missing_video_size.json b/adapters/huaweiads/huaweiadstest/supplemental/missing_video_size.json new file mode 100644 index 00000000000..c4d7697974a --- /dev/null +++ b/adapters/huaweiads/huaweiadstest/supplemental/missing_video_size.json @@ -0,0 +1,336 @@ +{ + "mockBidRequest": { + "id": "test-req-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video\/mp4" + ], + "playbackmethod": [ + 2 + ], + "protocols": [ + 2 + ], + "placement": 2, + "linearity": 1 + }, + "ext": { + "bidder": { + "slotid": "m8x9x3roll", + "adtype": "interstitial", + "publisherid": "123123123", + "signkey": "signkey", + "keyid": "41", + "isTestAuthorization": "true" + } + } + } + ], + "app": { + "bundle": "com.wavehk.android", + "name": "Huawei Browser", + "ver": "9.1.0.301" + }, + "device": { + "ua": "useragent", + "h": 1920, + "language": "en", + "model": "COL-TEST", + "os": "android", + "osv": "10.0.0", + "devicetype": 4, + "make": "huawei", + "w": 1080, + "ip": "ip", + "pxratio": 23.01, + "geo": { + "country": "ATA" + } + }, + "user": { + "ext": { + "data": { + "gaid": [ + "gaid" + ], + "oaid": [ + "oaid" + ], + "clientTime": [ + "2018-08-10 20:01:11.214+0200" + ] + } + } + }, + "ext": { + } + }, + "httpcalls": [ + { + "expectedRequest": { + "uri": "https://adx-dre.op.hicloud.com/ppsadx/getResult", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "User-Agent": [ + "useragent" + ], + "Authorization": [ + "Digest username=123123123,realm=ppsadx/getResult,nonce=1629473330823,response=6fdc975d3adac426cbe607eec736f40ad3db8413312457431e391580e1b475c4,algorithm=HmacSHA256,usertype=1,keyid=41" + ] + }, + "body": { + "app": { + "lang": "en", + "country": "AT", + "name": "Huawei Browser", + "pkgname": "com.wavehk.android", + "version": "9.1.0.301" + }, + "multislot": [ + { + "adtype": 12, + "slotid": "m8x9x3roll", + "test": 1 + } + ], + "device": { + "height": 1920, + "language": "en", + "oaid": "oaid", + "os": "android", + "type": 4, + "ip": "ip", + "localeCountry": "AT", + "pxratio": 23.01, + "width": 1080, + "model": "COL-TEST", + "clientTime": "2018-08-10 20:01:11.214+0200", + "gaid": "gaid", + "useragent": "useragent", + "version": "10.0.0", + "maker": "huawei", + "belongCountry": "AT" + }, + "geo": { + }, + "network": { + "type": 0 + }, + "regs": { + }, + "version": "3.4", + "clientAdRequestId": "test-req-id" + } + }, + "mockResponse": { + "status": 200, + "body": { + "multiad": [ + { + "adtype": 60, + "brsetting": "Y", + "content": [ + { + "contentid": "58001445", + "creativetype": 106, + "endtime": 1621344684645, + "interactiontype": 1, + "landingTitle": 1, + "metaData": { + "adSign": "2", + "mediaFile": { + "mime": "video/mp4", + "width": 720, + "height": 1280, + "fileSize": 10000, + "url": "https://test.png", + "sha256": "" + }, + "apkInfo": { + "appIcon": "https://pps-icon.png", + "appName": "%E6%89%8B%E6%9C%BA%E6%B7%98%E5%AE%9D", + "fileSize": 118902470, + "packageName": "com.demo.package", + "permPromptForCard": "0", + "popNotify": 1, + "popUpAfterInstallNew": 1, + "priorInstallWay": "2", + "sha256": "sha256", + "url": "https://test/apkurl", + "versionCode": "284", + "versionName": "9.6.1.9" + }, + "appId": "101219405", + "appPromotionChannel": "401721412", + "clickUrl": "https://ads.huawei.com/usermgtportal/home/index.html#/", + "cta": "%e5%ae%89%e8%a3%85", + "duration": 6038, + "icon": [ + { + "checkSha256Flag": 1, + "fileSize": 10797, + "height": 160, + "imageType": "img", + "sha256": "042479eccbda9a8d7d3aa3da73c42486854407835623a30ffff875cb578242d0", + "url": "https://pps-icon.png", + "width": 160 + } + ], + "imageInfo": [ + { + "checkSha256Flag": 0, + "height": 350, + "imageType": "img", + "sha256": "8baa56fdb2702b9fb044d95b328936160cd245764375cdb25a4ab504f4ae2e19", + "url": "http://image1.jpg", + "width": 400 + }, + { + "checkSha256Flag": 0, + "height": 300, + "imageType": "img", + "sha256": "8baa56fdb2702b9fb044d95b328936160cd245764375cdb25a4ab504f4ae2e19", + "url": "http://image2.jpg", + "width": 400 + } + ], + "label": "%E6%89%8B%E6%9C%BA%E6%B7%98%E5%AE%9D", + "landingPageType": "3", + "marketAppId": "C101219405", + "title": "%2Ftest%2F", + "description": "this is a test ad", + "videoInfo": { + "autoPlayAreaRatio": 100, + "autoStopPlayAreaRatio": 10, + "checkSha256Flag": 1, + "sha256": "aa08c8ffce82bbcd37cabefd6c8972b407de48f0b4e332e06d4cc18d25377d77", + "timeBeforeVideoAutoPlay": 50, + "videoAutoPlayOnWifi": "y", + "videoAutoPlayWithSound": "n", + "videoDownloadUrl": "https://video.mp4", + "videoDuration": 6038, + "videoFileSize": 949951, + "videoPlayMode": 2, + "videoRatio": 0.5625, + "width": 600, + "height": 500 + } + }, + "monitor": [ + { + "eventType": "vastError", + "url": [ + "http://test/vastError" + ] + }, + { + "eventType": "click", + "url": [ + "http://test/click", + "http://test/dspclick" + ] + }, + { + "eventType": "imp", + "url": [ + "http://test/imp", + "http://test/dspimp" + ] + }, + { + "eventType": "userclose", + "url": [ + "http://test/userclose" + ] + }, + { + "eventType": "playStart", + "url": [ + "http://test/playStart" + ] + }, + { + "eventType": "playEnd", + "url": [ + "http://test/playEnd1", + "http://test/playEnd2" + ] + }, + { + "eventType": "playResume", + "url": [ + "http://test/playResume" + ] + }, + { + "eventType": "playPause", + "url": [ + "http://test/playPause" + ] + }, + { + "eventType": "appOpen", + "url": [ + "http://test/appOpen" + ] + } + ], + "paramfromserver": { + "a": "1||test", + "sig": "", + "t": "99990101235959" + }, + "price": 2.8, + "starttime": 1620230400000, + "taskid": "48016632" + } + ], + "retcode30": 200, + "slotid": "m8x9x3roll" + } + ], + "noReportAdTypeEventList": [ + { + "adType": 8, + "eventTypeList": [ + "exception_6" + ] + } + ], + "retcode": 200, + "totalCacheSize": 300 + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "HuaweiAds/test/00:00:06.038 ", + "adomain": [ + "huaweiads" + ], + "h": 1280, + "w": 720, + "crid": "58001445", + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 2.8 + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/huaweiads/huaweiadstest/supplemental/zero_video_size.json b/adapters/huaweiads/huaweiadstest/supplemental/zero_video_size.json new file mode 100644 index 00000000000..4c38e56d1a0 --- /dev/null +++ b/adapters/huaweiads/huaweiadstest/supplemental/zero_video_size.json @@ -0,0 +1,338 @@ +{ + "mockBidRequest": { + "id": "test-req-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video\/mp4" + ], + "playbackmethod": [ + 2 + ], + "protocols": [ + 2 + ], + "w": 0, + "h": 0, + "placement": 2, + "linearity": 1 + }, + "ext": { + "bidder": { + "slotid": "m8x9x3roll", + "adtype": "interstitial", + "publisherid": "123123123", + "signkey": "signkey", + "keyid": "41", + "isTestAuthorization": "true" + } + } + } + ], + "app": { + "bundle": "com.wavehk.android", + "name": "Huawei Browser", + "ver": "9.1.0.301" + }, + "device": { + "ua": "useragent", + "h": 1920, + "language": "en", + "model": "COL-TEST", + "os": "android", + "osv": "10.0.0", + "devicetype": 4, + "make": "huawei", + "w": 1080, + "ip": "ip", + "pxratio": 23.01, + "geo": { + "country": "ATA" + } + }, + "user": { + "ext": { + "data": { + "gaid": [ + "gaid" + ], + "oaid": [ + "oaid" + ], + "clientTime": [ + "2018-08-10 20:01:11.214+0200" + ] + } + } + }, + "ext": { + } + }, + "httpcalls": [ + { + "expectedRequest": { + "uri": "https://adx-dre.op.hicloud.com/ppsadx/getResult", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "User-Agent": [ + "useragent" + ], + "Authorization": [ + "Digest username=123123123,realm=ppsadx/getResult,nonce=1629473330823,response=6fdc975d3adac426cbe607eec736f40ad3db8413312457431e391580e1b475c4,algorithm=HmacSHA256,usertype=1,keyid=41" + ] + }, + "body": { + "app": { + "lang": "en", + "country": "AT", + "name": "Huawei Browser", + "pkgname": "com.wavehk.android", + "version": "9.1.0.301" + }, + "multislot": [ + { + "adtype": 12, + "slotid": "m8x9x3roll", + "test": 1 + } + ], + "device": { + "height": 1920, + "language": "en", + "oaid": "oaid", + "os": "android", + "type": 4, + "ip": "ip", + "localeCountry": "AT", + "pxratio": 23.01, + "width": 1080, + "model": "COL-TEST", + "clientTime": "2018-08-10 20:01:11.214+0200", + "gaid": "gaid", + "useragent": "useragent", + "version": "10.0.0", + "maker": "huawei", + "belongCountry": "AT" + }, + "geo": { + }, + "network": { + "type": 0 + }, + "regs": { + }, + "version": "3.4", + "clientAdRequestId": "test-req-id" + } + }, + "mockResponse": { + "status": 200, + "body": { + "multiad": [ + { + "adtype": 60, + "brsetting": "Y", + "content": [ + { + "contentid": "58001445", + "creativetype": 106, + "endtime": 1621344684645, + "interactiontype": 1, + "landingTitle": 1, + "metaData": { + "adSign": "2", + "mediaFile": { + "mime": "video/mp4", + "width": 720, + "height": 1280, + "fileSize": 10000, + "url": "https://test.png", + "sha256": "" + }, + "apkInfo": { + "appIcon": "https://pps-icon.png", + "appName": "%E6%89%8B%E6%9C%BA%E6%B7%98%E5%AE%9D", + "fileSize": 118902470, + "packageName": "com.demo.package", + "permPromptForCard": "0", + "popNotify": 1, + "popUpAfterInstallNew": 1, + "priorInstallWay": "2", + "sha256": "sha256", + "url": "https://test/apkurl", + "versionCode": "284", + "versionName": "9.6.1.9" + }, + "appId": "101219405", + "appPromotionChannel": "401721412", + "clickUrl": "https://ads.huawei.com/usermgtportal/home/index.html#/", + "cta": "%e5%ae%89%e8%a3%85", + "duration": 6038, + "icon": [ + { + "checkSha256Flag": 1, + "fileSize": 10797, + "height": 160, + "imageType": "img", + "sha256": "042479eccbda9a8d7d3aa3da73c42486854407835623a30ffff875cb578242d0", + "url": "https://pps-icon.png", + "width": 160 + } + ], + "imageInfo": [ + { + "checkSha256Flag": 0, + "height": 350, + "imageType": "img", + "sha256": "8baa56fdb2702b9fb044d95b328936160cd245764375cdb25a4ab504f4ae2e19", + "url": "http://image1.jpg", + "width": 400 + }, + { + "checkSha256Flag": 0, + "height": 300, + "imageType": "img", + "sha256": "8baa56fdb2702b9fb044d95b328936160cd245764375cdb25a4ab504f4ae2e19", + "url": "http://image2.jpg", + "width": 400 + } + ], + "label": "%E6%89%8B%E6%9C%BA%E6%B7%98%E5%AE%9D", + "landingPageType": "3", + "marketAppId": "C101219405", + "title": "%2Ftest%2F", + "description": "this is a test ad", + "videoInfo": { + "autoPlayAreaRatio": 100, + "autoStopPlayAreaRatio": 10, + "checkSha256Flag": 1, + "sha256": "aa08c8ffce82bbcd37cabefd6c8972b407de48f0b4e332e06d4cc18d25377d77", + "timeBeforeVideoAutoPlay": 50, + "videoAutoPlayOnWifi": "y", + "videoAutoPlayWithSound": "n", + "videoDownloadUrl": "https://video.mp4", + "videoDuration": 6038, + "videoFileSize": 949951, + "videoPlayMode": 2, + "videoRatio": 0.5625, + "width": 600, + "height": 500 + } + }, + "monitor": [ + { + "eventType": "vastError", + "url": [ + "http://test/vastError" + ] + }, + { + "eventType": "click", + "url": [ + "http://test/click", + "http://test/dspclick" + ] + }, + { + "eventType": "imp", + "url": [ + "http://test/imp", + "http://test/dspimp" + ] + }, + { + "eventType": "userclose", + "url": [ + "http://test/userclose" + ] + }, + { + "eventType": "playStart", + "url": [ + "http://test/playStart" + ] + }, + { + "eventType": "playEnd", + "url": [ + "http://test/playEnd1", + "http://test/playEnd2" + ] + }, + { + "eventType": "playResume", + "url": [ + "http://test/playResume" + ] + }, + { + "eventType": "playPause", + "url": [ + "http://test/playPause" + ] + }, + { + "eventType": "appOpen", + "url": [ + "http://test/appOpen" + ] + } + ], + "paramfromserver": { + "a": "1||test", + "sig": "", + "t": "99990101235959" + }, + "price": 2.8, + "starttime": 1620230400000, + "taskid": "48016632" + } + ], + "retcode30": 200, + "slotid": "m8x9x3roll" + } + ], + "noReportAdTypeEventList": [ + { + "adType": 8, + "eventTypeList": [ + "exception_6" + ] + } + ], + "retcode": 200, + "totalCacheSize": 300 + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "HuaweiAds/test/00:00:06.038 ", + "adomain": [ + "huaweiads" + ], + "h": 1280, + "w": 720, + "crid": "58001445", + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 2.8 + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/imds/imds.go b/adapters/imds/imds.go index c5ef45176ab..87583f0f6a3 100644 --- a/adapters/imds/imds.go +++ b/adapters/imds/imds.go @@ -7,7 +7,7 @@ import ( "net/url" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/impactify/impactify.go b/adapters/impactify/impactify.go index 73dc9450a3b..2b42230e46c 100644 --- a/adapters/impactify/impactify.go +++ b/adapters/impactify/impactify.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/improvedigital/improvedigital.go b/adapters/improvedigital/improvedigital.go index 2cad15fa033..c00acfa74ad 100644 --- a/adapters/improvedigital/improvedigital.go +++ b/adapters/improvedigital/improvedigital.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/infoawarebidder.go b/adapters/infoawarebidder.go index 3131a6404b1..9361e06fee0 100644 --- a/adapters/infoawarebidder.go +++ b/adapters/infoawarebidder.go @@ -3,7 +3,7 @@ package adapters import ( "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/infoawarebidder_test.go b/adapters/infoawarebidder_test.go index 38570e262d4..7476cc920c9 100644 --- a/adapters/infoawarebidder_test.go +++ b/adapters/infoawarebidder_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/infytv/infytv.go b/adapters/infytv/infytv.go index 7e93a7296a5..b0dbcb5b476 100644 --- a/adapters/infytv/infytv.go +++ b/adapters/infytv/infytv.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/inmobi/inmobi.go b/adapters/inmobi/inmobi.go index 54d644cdc7d..3c20fdc5627 100644 --- a/adapters/inmobi/inmobi.go +++ b/adapters/inmobi/inmobi.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/interactiveoffers/interactiveoffers.go b/adapters/interactiveoffers/interactiveoffers.go index 2e1a6417f14..210b3f28ca5 100644 --- a/adapters/interactiveoffers/interactiveoffers.go +++ b/adapters/interactiveoffers/interactiveoffers.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/invibes/invibes.go b/adapters/invibes/invibes.go index e1b978831b8..f66a7359bf9 100644 --- a/adapters/invibes/invibes.go +++ b/adapters/invibes/invibes.go @@ -9,7 +9,7 @@ import ( "strings" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/iqx/iqx.go b/adapters/iqx/iqx.go index edfefa1895e..5838ba379aa 100644 --- a/adapters/iqx/iqx.go +++ b/adapters/iqx/iqx.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/iqzone/iqzone.go b/adapters/iqzone/iqzone.go index ce095c97009..1888711df93 100644 --- a/adapters/iqzone/iqzone.go +++ b/adapters/iqzone/iqzone.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index 35b3f7f2711..356562675d1 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -11,11 +11,12 @@ import ( "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/prebid/prebid-server/v2/version" - "github.com/prebid/openrtb/v19/native1" - native1response "github.com/prebid/openrtb/v19/native1/response" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/native1" + native1response "github.com/prebid/openrtb/v20/native1/response" + "github.com/prebid/openrtb/v20/openrtb2" ) type IxAdapter struct { @@ -83,8 +84,8 @@ func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters } if len(bannerCopy.Format) == 1 { - bannerCopy.W = openrtb2.Int64Ptr(bannerCopy.Format[0].W) - bannerCopy.H = openrtb2.Int64Ptr(bannerCopy.Format[0].H) + bannerCopy.W = ptrutil.ToPtr(bannerCopy.Format[0].W) + bannerCopy.H = ptrutil.ToPtr(bannerCopy.Format[0].H) } imp.Banner = &bannerCopy } diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index 5e2450e7ded..2b48327605a 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -8,11 +8,12 @@ import ( "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/prebid/prebid-server/v2/version" "github.com/stretchr/testify/assert" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" ) const endpoint string = "http://host/endpoint" @@ -32,8 +33,8 @@ func TestIxMakeBidsWithCategoryDuration(t *testing.T) { Imp: []openrtb2.Imp{{ ID: "1_1", Video: &openrtb2.Video{ - W: 640, - H: 360, + W: ptrutil.ToPtr[int64](640), + H: ptrutil.ToPtr[int64](360), MIMEs: []string{"video/mp4"}, MaxDuration: 60, Protocols: []adcom1.MediaCreativeSubtype{2, 3, 5, 6}, @@ -111,8 +112,8 @@ func TestIxMakeRequestWithGppString(t *testing.T) { Imp: []openrtb2.Imp{{ ID: "1_1", Video: &openrtb2.Video{ - W: 640, - H: 360, + W: ptrutil.ToPtr[int64](640), + H: ptrutil.ToPtr[int64](360), MIMEs: []string{"video/mp4"}, MaxDuration: 60, Protocols: []adcom1.MediaCreativeSubtype{2, 3, 5, 6}, diff --git a/adapters/jixie/jixie.go b/adapters/jixie/jixie.go index fa87bd5da03..401fd31cf44 100644 --- a/adapters/jixie/jixie.go +++ b/adapters/jixie/jixie.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/kargo/kargo.go b/adapters/kargo/kargo.go index 003275c51d3..df31e1b64fd 100644 --- a/adapters/kargo/kargo.go +++ b/adapters/kargo/kargo.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/kayzen/kayzen.go b/adapters/kayzen/kayzen.go index a4c459ac2a2..2b98def0ec2 100644 --- a/adapters/kayzen/kayzen.go +++ b/adapters/kayzen/kayzen.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/kidoz/kidoz.go b/adapters/kidoz/kidoz.go index f18ed98c07b..2eb5de1e319 100644 --- a/adapters/kidoz/kidoz.go +++ b/adapters/kidoz/kidoz.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/kidoz/kidoz_test.go b/adapters/kidoz/kidoz_test.go index 0a5e21fd62d..9a36764ee97 100644 --- a/adapters/kidoz/kidoz_test.go +++ b/adapters/kidoz/kidoz_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/kiviads/kiviads.go b/adapters/kiviads/kiviads.go index 8bdf72145d4..1c55f929bb3 100644 --- a/adapters/kiviads/kiviads.go +++ b/adapters/kiviads/kiviads.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/krushmedia/krushmedia.go b/adapters/krushmedia/krushmedia.go index e809960db8c..e7d72f58b3e 100644 --- a/adapters/krushmedia/krushmedia.go +++ b/adapters/krushmedia/krushmedia.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/lemmadigital/lemmadigital.go b/adapters/lemmadigital/lemmadigital.go index d09793fa4e8..ec052a1369b 100644 --- a/adapters/lemmadigital/lemmadigital.go +++ b/adapters/lemmadigital/lemmadigital.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/liftoff/liftoff.go b/adapters/liftoff/liftoff.go index 0dd881dfa2e..1a8ee5c6bd2 100644 --- a/adapters/liftoff/liftoff.go +++ b/adapters/liftoff/liftoff.go @@ -7,7 +7,7 @@ import ( "net/http" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/limelightDigital/limelightDigital.go b/adapters/limelightDigital/limelightDigital.go index d9920c72383..54ef8dc6fba 100644 --- a/adapters/limelightDigital/limelightDigital.go +++ b/adapters/limelightDigital/limelightDigital.go @@ -8,7 +8,7 @@ import ( "strings" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/lm_kiviads/lmkiviads.go b/adapters/lm_kiviads/lmkiviads.go index 03c17e6439c..a4f292435bc 100644 --- a/adapters/lm_kiviads/lmkiviads.go +++ b/adapters/lm_kiviads/lmkiviads.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/lockerdome/lockerdome.go b/adapters/lockerdome/lockerdome.go index c52a51a1003..512b84177b0 100644 --- a/adapters/lockerdome/lockerdome.go +++ b/adapters/lockerdome/lockerdome.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/logan/logan.go b/adapters/logan/logan.go index e5e76bca75b..5f572c401aa 100644 --- a/adapters/logan/logan.go +++ b/adapters/logan/logan.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/logicad/logicad.go b/adapters/logicad/logicad.go index 2bd60077ae0..a4fd0af8a11 100644 --- a/adapters/logicad/logicad.go +++ b/adapters/logicad/logicad.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/lunamedia/lunamedia.go b/adapters/lunamedia/lunamedia.go index 99a54deb82f..1da30525615 100644 --- a/adapters/lunamedia/lunamedia.go +++ b/adapters/lunamedia/lunamedia.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/mabidder/mabidder.go b/adapters/mabidder/mabidder.go index 9f7323c005d..9bb6dedf259 100644 --- a/adapters/mabidder/mabidder.go +++ b/adapters/mabidder/mabidder.go @@ -3,7 +3,7 @@ package mabidder import ( "encoding/json" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/madvertise/madvertise.go b/adapters/madvertise/madvertise.go index 41097f62ab6..6b75fcf3195 100644 --- a/adapters/madvertise/madvertise.go +++ b/adapters/madvertise/madvertise.go @@ -6,8 +6,8 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/madvertise/madvertisetest/exemplary/simple-video.json b/adapters/madvertise/madvertisetest/exemplary/simple-video.json index a387c06eeac..5fb7e800e8f 100644 --- a/adapters/madvertise/madvertisetest/exemplary/simple-video.json +++ b/adapters/madvertise/madvertisetest/exemplary/simple-video.json @@ -176,6 +176,7 @@ 1, 3 ], + "boxingallowed": 0, "protocols": [ 1, 2, diff --git a/adapters/marsmedia/marsmedia.go b/adapters/marsmedia/marsmedia.go index c75b4f7ad6b..7ff9fbbbb94 100644 --- a/adapters/marsmedia/marsmedia.go +++ b/adapters/marsmedia/marsmedia.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/medianet/medianet.go b/adapters/medianet/medianet.go index f84705aaa28..2750bd559a6 100644 --- a/adapters/medianet/medianet.go +++ b/adapters/medianet/medianet.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/mgid/mgid.go b/adapters/mgid/mgid.go index 712c6cd8928..a6e9606f378 100644 --- a/adapters/mgid/mgid.go +++ b/adapters/mgid/mgid.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/mgidX/mgidX.go b/adapters/mgidX/mgidX.go index 084fdaebca9..8f67be409ed 100644 --- a/adapters/mgidX/mgidX.go +++ b/adapters/mgidX/mgidX.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/minutemedia/minutemedia.go b/adapters/minutemedia/minutemedia.go index 0d0bceeac1b..70c81504442 100644 --- a/adapters/minutemedia/minutemedia.go +++ b/adapters/minutemedia/minutemedia.go @@ -8,7 +8,7 @@ import ( "net/url" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/mobfoxpb/mobfoxpb.go b/adapters/mobfoxpb/mobfoxpb.go index 24e13e26584..a6e002befce 100644 --- a/adapters/mobfoxpb/mobfoxpb.go +++ b/adapters/mobfoxpb/mobfoxpb.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/mobilefuse/mobilefuse.go b/adapters/mobilefuse/mobilefuse.go index 24461ade471..30f24b3d3c3 100644 --- a/adapters/mobilefuse/mobilefuse.go +++ b/adapters/mobilefuse/mobilefuse.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/motorik/motorik.go b/adapters/motorik/motorik.go index 95bb4837c9a..652d28badc6 100644 --- a/adapters/motorik/motorik.go +++ b/adapters/motorik/motorik.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/nextmillennium/nextmillennium.go b/adapters/nextmillennium/nextmillennium.go index 966f96de47a..ad266e5e6f3 100644 --- a/adapters/nextmillennium/nextmillennium.go +++ b/adapters/nextmillennium/nextmillennium.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/nobid/nobid.go b/adapters/nobid/nobid.go index 63d20d87fc0..8188def9681 100644 --- a/adapters/nobid/nobid.go +++ b/adapters/nobid/nobid.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/oms/oms.go b/adapters/oms/oms.go index af16cc78ace..c4121a90614 100644 --- a/adapters/oms/oms.go +++ b/adapters/oms/oms.go @@ -3,12 +3,13 @@ package oms import ( "encoding/json" "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "net/http" + + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" - "net/http" ) type adapter struct { diff --git a/adapters/onetag/onetag.go b/adapters/onetag/onetag.go index 9036de80ced..7745d1a18ae 100644 --- a/adapters/onetag/onetag.go +++ b/adapters/onetag/onetag.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/openweb/openweb.go b/adapters/openweb/openweb.go index 45fd2853aec..16a5ff91689 100644 --- a/adapters/openweb/openweb.go +++ b/adapters/openweb/openweb.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/openx/openx.go b/adapters/openx/openx.go index f86b7b143fb..c29be0baa81 100644 --- a/adapters/openx/openx.go +++ b/adapters/openx/openx.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/openx/openx_test.go b/adapters/openx/openx_test.go index d998148da87..6f3796929a5 100644 --- a/adapters/openx/openx_test.go +++ b/adapters/openx/openx_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/operaads/operaads.go b/adapters/operaads/operaads.go index f6af4039fb6..222d148ed93 100644 --- a/adapters/operaads/operaads.go +++ b/adapters/operaads/operaads.go @@ -13,8 +13,9 @@ import ( "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/macros" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) type adapter struct { @@ -184,8 +185,8 @@ func convertBanner(banner *openrtb2.Banner) (*openrtb2.Banner, error) { if len(banner.Format) > 0 { f := banner.Format[0] bannerCopy := *banner - bannerCopy.W = openrtb2.Int64Ptr(f.W) - bannerCopy.H = openrtb2.Int64Ptr(f.H) + bannerCopy.W = ptrutil.ToPtr(f.W) + bannerCopy.H = ptrutil.ToPtr(f.H) return &bannerCopy, nil } else { return nil, errBannerFormatMiss diff --git a/adapters/orbidder/orbidder.go b/adapters/orbidder/orbidder.go index 8f1c582afe7..41d5c37002b 100644 --- a/adapters/orbidder/orbidder.go +++ b/adapters/orbidder/orbidder.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/orbidder/orbidder_test.go b/adapters/orbidder/orbidder_test.go index 39919da06e0..a97fc307c92 100644 --- a/adapters/orbidder/orbidder_test.go +++ b/adapters/orbidder/orbidder_test.go @@ -5,7 +5,7 @@ import ( "errors" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/mock" "github.com/prebid/prebid-server/v2/adapters" diff --git a/adapters/outbrain/outbrain.go b/adapters/outbrain/outbrain.go index 1d07c082507..5768abab650 100644 --- a/adapters/outbrain/outbrain.go +++ b/adapters/outbrain/outbrain.go @@ -5,9 +5,9 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/native1" - nativeResponse "github.com/prebid/openrtb/v19/native1/response" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/native1" + nativeResponse "github.com/prebid/openrtb/v20/native1/response" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/ownadx/ownadx.go b/adapters/ownadx/ownadx.go index 77baa63b4cd..5678808b99b 100644 --- a/adapters/ownadx/ownadx.go +++ b/adapters/ownadx/ownadx.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/pangle/pangle.go b/adapters/pangle/pangle.go index 7c18a840025..1bdffb9ba4b 100644 --- a/adapters/pangle/pangle.go +++ b/adapters/pangle/pangle.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/pgamssp/pgamssp.go b/adapters/pgamssp/pgamssp.go index 3e315fedc95..742d2c37dfb 100644 --- a/adapters/pgamssp/pgamssp.go +++ b/adapters/pgamssp/pgamssp.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/pubmatic/pubmatic.go b/adapters/pubmatic/pubmatic.go index 7ab0248b937..9876041ec4e 100644 --- a/adapters/pubmatic/pubmatic.go +++ b/adapters/pubmatic/pubmatic.go @@ -9,12 +9,14 @@ import ( "strconv" "strings" - "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" + + "github.com/buger/jsonparser" + "github.com/prebid/openrtb/v20/openrtb2" ) const MAX_IMPRESSIONS_PUBMATIC = 30 @@ -235,8 +237,8 @@ func assignBannerSize(banner *openrtb2.Banner) (*openrtb2.Banner, error) { func assignBannerWidthAndHeight(banner *openrtb2.Banner, w, h int64) *openrtb2.Banner { bannerCopy := *banner - bannerCopy.W = openrtb2.Int64Ptr(w) - bannerCopy.H = openrtb2.Int64Ptr(h) + bannerCopy.W = ptrutil.ToPtr(w) + bannerCopy.H = ptrutil.ToPtr(h) return &bannerCopy } diff --git a/adapters/pubmatic/pubmatic_test.go b/adapters/pubmatic/pubmatic_test.go index b40bf2d4fb2..747dd5de0d8 100644 --- a/adapters/pubmatic/pubmatic_test.go +++ b/adapters/pubmatic/pubmatic_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/pubnative/pubnative.go b/adapters/pubnative/pubnative.go index da3cab34dae..bc01cd04cd5 100644 --- a/adapters/pubnative/pubnative.go +++ b/adapters/pubnative/pubnative.go @@ -7,11 +7,12 @@ import ( "net/url" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) type PubnativeAdapter struct { @@ -112,8 +113,8 @@ func convertBanner(banner *openrtb2.Banner) (*openrtb2.Banner, error) { bannerCopy := *banner - bannerCopy.W = openrtb2.Int64Ptr(f.W) - bannerCopy.H = openrtb2.Int64Ptr(f.H) + bannerCopy.W = ptrutil.ToPtr(f.W) + bannerCopy.H = ptrutil.ToPtr(f.H) return &bannerCopy, nil } else { diff --git a/adapters/pulsepoint/pulsepoint.go b/adapters/pulsepoint/pulsepoint.go index f65e010341e..faf1c41ddb4 100644 --- a/adapters/pulsepoint/pulsepoint.go +++ b/adapters/pulsepoint/pulsepoint.go @@ -11,7 +11,7 @@ import ( "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) type PulsePointAdapter struct { diff --git a/adapters/pwbid/pwbid.go b/adapters/pwbid/pwbid.go index 2452c08a863..a5ed6c1ebed 100644 --- a/adapters/pwbid/pwbid.go +++ b/adapters/pwbid/pwbid.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/relevantdigital/relevantdigital.go b/adapters/relevantdigital/relevantdigital.go index e8b1df8c100..be16b49dac4 100644 --- a/adapters/relevantdigital/relevantdigital.go +++ b/adapters/relevantdigital/relevantdigital.go @@ -9,7 +9,7 @@ import ( "text/template" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/revcontent/revcontent.go b/adapters/revcontent/revcontent.go index b53f8962d4d..456e4cef7f2 100644 --- a/adapters/revcontent/revcontent.go +++ b/adapters/revcontent/revcontent.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/richaudience/richaudience.go b/adapters/richaudience/richaudience.go index 2d976cc7c7b..dc2dd23bdaf 100644 --- a/adapters/richaudience/richaudience.go +++ b/adapters/richaudience/richaudience.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" @@ -106,7 +106,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte } if imp.Video != nil { - if imp.Video.W == 0 || imp.Video.H == 0 { + if imp.Video.W == nil || *imp.Video.W == 0 || imp.Video.H == nil || *imp.Video.H == 0 { errs = append(errs, &errortypes.BadInput{ Message: "request.Video.Sizes is required", }) @@ -179,8 +179,8 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R bidType := getMediaType(seatBid.Bid[i].ImpID, reqBid) if bidType == "video" { - seatBid.Bid[i].W = reqBid.Video.W - seatBid.Bid[i].H = reqBid.Video.H + seatBid.Bid[i].W = *reqBid.Video.W + seatBid.Bid[i].H = *reqBid.Video.H } b := &adapters.TypedBid{ diff --git a/adapters/richaudience/richaudience_test.go b/adapters/richaudience/richaudience_test.go index ee1ece29a91..6150e45e1a0 100644 --- a/adapters/richaudience/richaudience_test.go +++ b/adapters/richaudience/richaudience_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/richaudience/richaudiencetest/supplemental/videoSizePartial.json b/adapters/richaudience/richaudiencetest/supplemental/videoSizePartial.json new file mode 100644 index 00000000000..44af959032c --- /dev/null +++ b/adapters/richaudience/richaudiencetest/supplemental/videoSizePartial.json @@ -0,0 +1,42 @@ +{ + "mockBidRequest": { + "id": "4d3f84eb-787b-42fb-a0cf-062690dadce3", + "test": 0, + "imp": [ + { + "id": "div-gpt-ad-1460505748561-0", + "video": { + "h": 100 + }, + "bidfloor": 1e-05, + "bidfloorcur": "USD", + "ext": { + "bidder": { + "pid": "OsNsyeF68q", + "supplyType": "site", + "test": false + } + } + } + ], + "site": { + "keywords": "tagid=", + "domain": "bridge.richmediastudio.com", + "page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true" + }, + "device": { + "ip": "11.222.33.44", + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36" + }, + "user": { + "buyeruid": "", + "ext": {} + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "request.Video.Sizes is required", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/richaudience/richaudiencetest/supplemental/videoSizeZero.json b/adapters/richaudience/richaudiencetest/supplemental/videoSizeZero.json new file mode 100644 index 00000000000..56c825c5a5f --- /dev/null +++ b/adapters/richaudience/richaudiencetest/supplemental/videoSizeZero.json @@ -0,0 +1,43 @@ +{ + "mockBidRequest": { + "id": "4d3f84eb-787b-42fb-a0cf-062690dadce3", + "test": 0, + "imp": [ + { + "id": "div-gpt-ad-1460505748561-0", + "video": { + "w": 0, + "h": 0 + }, + "bidfloor": 1e-05, + "bidfloorcur": "USD", + "ext": { + "bidder": { + "pid": "OsNsyeF68q", + "supplyType": "site", + "test": false + } + } + } + ], + "site": { + "keywords": "tagid=", + "domain": "bridge.richmediastudio.com", + "page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true" + }, + "device": { + "ip": "11.222.33.44", + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36" + }, + "user": { + "buyeruid": "", + "ext": {} + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "request.Video.Sizes is required", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/rise/rise.go b/adapters/rise/rise.go index 56fdc4a8fff..025fb713bfa 100644 --- a/adapters/rise/rise.go +++ b/adapters/rise/rise.go @@ -7,7 +7,7 @@ import ( "net/http" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/rtbhouse/rtbhouse.go b/adapters/rtbhouse/rtbhouse.go index 92e0e57b287..2065163c660 100644 --- a/adapters/rtbhouse/rtbhouse.go +++ b/adapters/rtbhouse/rtbhouse.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/rubicon/rubicon.go b/adapters/rubicon/rubicon.go index 7d09224e8b4..01b1e79799e 100644 --- a/adapters/rubicon/rubicon.go +++ b/adapters/rubicon/rubicon.go @@ -15,8 +15,8 @@ import ( "github.com/prebid/prebid-server/v2/util/maputil" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" ) const badvLimitSize = 50 diff --git a/adapters/rubicon/rubicon_test.go b/adapters/rubicon/rubicon_test.go index 334a5e269c0..7a420a10eca 100644 --- a/adapters/rubicon/rubicon_test.go +++ b/adapters/rubicon/rubicon_test.go @@ -13,10 +13,11 @@ import ( "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) @@ -337,8 +338,8 @@ func TestOpenRTBRequest(t *testing.T) { }, { ID: "test-imp-video-id", Video: &openrtb2.Video{ - W: 640, - H: 360, + W: ptrutil.ToPtr[int64](640), + H: ptrutil.ToPtr[int64](360), MIMEs: []string{"video/mp4"}, MinDuration: 15, MaxDuration: 30, @@ -419,10 +420,10 @@ func TestOpenRTBRequest(t *testing.T) { t.Fatal("Error unmarshalling request from the outgoing request.") } - assert.Equal(t, int64(640), rpRequest.Imp[0].Video.W, + assert.Equal(t, ptrutil.ToPtr[int64](640), rpRequest.Imp[0].Video.W, "Video width does not match. Expected %d, Got %d", 640, rpRequest.Imp[0].Video.W) - assert.Equal(t, int64(360), rpRequest.Imp[0].Video.H, + assert.Equal(t, ptrutil.ToPtr[int64](360), rpRequest.Imp[0].Video.H, "Video height does not match. Expected %d, Got %d", 360, rpRequest.Imp[0].Video.H) assert.Equal(t, "video/mp4", rpRequest.Imp[0].Video.MIMEs[0], "Video MIMEs do not match. Expected %s, Got %s", "video/mp4", rpRequest.Imp[0].Video.MIMEs[0]) @@ -460,8 +461,8 @@ func TestOpenRTBRequestWithBannerImpEvenIfImpHasVideo(t *testing.T) { }, }, Video: &openrtb2.Video{ - W: 640, - H: 360, + W: ptrutil.ToPtr[int64](640), + H: ptrutil.ToPtr[int64](360), MIMEs: []string{"video/mp4"}, }, Ext: json.RawMessage(`{"bidder": { @@ -657,8 +658,8 @@ func TestOpenRTBRequestWithVideoImpEvenIfImpHasBannerButAllRequiredVideoFields(t }, }, Video: &openrtb2.Video{ - W: 640, - H: 360, + W: ptrutil.ToPtr[int64](640), + H: ptrutil.ToPtr[int64](360), MIMEs: []string{"video/mp4"}, Protocols: []adcom1.MediaCreativeSubtype{adcom1.CreativeVAST10}, MaxDuration: 30, @@ -707,8 +708,8 @@ func TestOpenRTBRequestWithVideoImpAndEnabledRewardedInventoryFlag(t *testing.T) Imp: []openrtb2.Imp{{ ID: "test-imp-id", Video: &openrtb2.Video{ - W: 640, - H: 360, + W: ptrutil.ToPtr[int64](640), + H: ptrutil.ToPtr[int64](360), MIMEs: []string{"video/mp4"}, Protocols: []adcom1.MediaCreativeSubtype{adcom1.CreativeVAST10}, MaxDuration: 30, diff --git a/adapters/sa_lunamedia/salunamedia.go b/adapters/sa_lunamedia/salunamedia.go index 0d7d253114b..8d7edc5244b 100644 --- a/adapters/sa_lunamedia/salunamedia.go +++ b/adapters/sa_lunamedia/salunamedia.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/screencore/screencore.go b/adapters/screencore/screencore.go index d5c2899af20..be951c23c38 100644 --- a/adapters/screencore/screencore.go +++ b/adapters/screencore/screencore.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/seedingAlliance/seedingAlliance.go b/adapters/seedingAlliance/seedingAlliance.go index 92b339d1fc4..03b6853b975 100644 --- a/adapters/seedingAlliance/seedingAlliance.go +++ b/adapters/seedingAlliance/seedingAlliance.go @@ -8,7 +8,7 @@ import ( "strings" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/seedingAlliance/seedingAlliance_test.go b/adapters/seedingAlliance/seedingAlliance_test.go index c6a5cfb1949..6d9460b875e 100644 --- a/adapters/seedingAlliance/seedingAlliance_test.go +++ b/adapters/seedingAlliance/seedingAlliance_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/sharethrough/sharethrough.go b/adapters/sharethrough/sharethrough.go index 7287ca6b86e..db20126928f 100644 --- a/adapters/sharethrough/sharethrough.go +++ b/adapters/sharethrough/sharethrough.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/silvermob/silvermob.go b/adapters/silvermob/silvermob.go index eaa45cb4be0..144c54ecb7b 100644 --- a/adapters/silvermob/silvermob.go +++ b/adapters/silvermob/silvermob.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/silverpush/devicetype.go b/adapters/silverpush/devicetype.go index a44464048c2..0dda105e7c8 100644 --- a/adapters/silverpush/devicetype.go +++ b/adapters/silverpush/devicetype.go @@ -4,7 +4,7 @@ import ( "regexp" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) var isValidMobile = regexp.MustCompile(`(ios|ipod|ipad|iphone|android)`) diff --git a/adapters/silverpush/silverpush.go b/adapters/silverpush/silverpush.go index 805ef96657a..1b1b327721b 100644 --- a/adapters/silverpush/silverpush.go +++ b/adapters/silverpush/silverpush.go @@ -5,11 +5,12 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) const ( @@ -207,8 +208,8 @@ func setBannerDimension(banner *openrtb2.Banner) (*openrtb2.Banner, error) { return banner, &errortypes.BadInput{Message: "No sizes provided for Banner."} } bannerCopy := *banner - bannerCopy.W = openrtb2.Int64Ptr(banner.Format[0].W) - bannerCopy.H = openrtb2.Int64Ptr(banner.Format[0].H) + bannerCopy.W = ptrutil.ToPtr(banner.Format[0].W) + bannerCopy.H = ptrutil.ToPtr(banner.Format[0].H) return &bannerCopy, nil } diff --git a/adapters/silverpush/silverpush_test.go b/adapters/silverpush/silverpush_test.go index 630539c0697..7d515bf242c 100644 --- a/adapters/silverpush/silverpush_test.go +++ b/adapters/silverpush/silverpush_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/smaato/smaato.go b/adapters/smaato/smaato.go index ffdeca06d7a..09d973c7992 100644 --- a/adapters/smaato/smaato.go +++ b/adapters/smaato/smaato.go @@ -8,12 +8,13 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/metrics" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/prebid/prebid-server/v2/util/timeutil" ) @@ -551,8 +552,8 @@ func setBannerDimension(banner *openrtb2.Banner) (*openrtb2.Banner, error) { return banner, &errortypes.BadInput{Message: "No sizes provided for Banner."} } bannerCopy := *banner - bannerCopy.W = openrtb2.Int64Ptr(banner.Format[0].W) - bannerCopy.H = openrtb2.Int64Ptr(banner.Format[0].H) + bannerCopy.W = ptrutil.ToPtr(banner.Format[0].W) + bannerCopy.H = ptrutil.ToPtr(banner.Format[0].H) return &bannerCopy, nil } diff --git a/adapters/smaato/smaato_test.go b/adapters/smaato/smaato_test.go index 0d7d39027ea..2da9fc5b652 100644 --- a/adapters/smaato/smaato_test.go +++ b/adapters/smaato/smaato_test.go @@ -5,14 +5,15 @@ import ( "testing" "time" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) func TestJsonSamples(t *testing.T) { @@ -37,8 +38,8 @@ func TestVideoWithCategoryAndDuration(t *testing.T) { Imp: []openrtb2.Imp{{ ID: "1_1", Video: &openrtb2.Video{ - W: 640, - H: 360, + W: ptrutil.ToPtr[int64](640), + H: ptrutil.ToPtr[int64](360), MIMEs: []string{"video/mp4"}, MaxDuration: 60, Protocols: []adcom1.MediaCreativeSubtype{2, 3, 5, 6}, diff --git a/adapters/smartadserver/smartadserver.go b/adapters/smartadserver/smartadserver.go index ce14533f78b..a190f8c298b 100644 --- a/adapters/smartadserver/smartadserver.go +++ b/adapters/smartadserver/smartadserver.go @@ -8,7 +8,7 @@ import ( "path" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/smartadserver/smartadservertest/exemplary/native-app.json b/adapters/smartadserver/smartadservertest/exemplary/native-app.json index 86c41e43d10..1ef88da0ddc 100644 --- a/adapters/smartadserver/smartadservertest/exemplary/native-app.json +++ b/adapters/smartadserver/smartadservertest/exemplary/native-app.json @@ -135,6 +135,7 @@ "content": { "url": "https://play.google.com/store/apps/details?id\u003djp.gocro.smartnews.android", "userrating": "4.2", + "livestream": 0, "language": "en" }, "storeurl": "https://play.google.com/store/apps/details?id\u003djp.gocro.smartnews.android", diff --git a/adapters/smarthub/smarthub.go b/adapters/smarthub/smarthub.go index 877987dd2e0..35cf1f0ce55 100644 --- a/adapters/smarthub/smarthub.go +++ b/adapters/smarthub/smarthub.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/smartrtb/smartrtb.go b/adapters/smartrtb/smartrtb.go index 875d9fc2aac..4cb1db8c7e0 100644 --- a/adapters/smartrtb/smartrtb.go +++ b/adapters/smartrtb/smartrtb.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/smartx/smartx.go b/adapters/smartx/smartx.go index 7b928ec198c..181f2802afd 100644 --- a/adapters/smartx/smartx.go +++ b/adapters/smartx/smartx.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/smartyads/smartyads.go b/adapters/smartyads/smartyads.go index ce50e926444..8dd32854345 100644 --- a/adapters/smartyads/smartyads.go +++ b/adapters/smartyads/smartyads.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/smilewanted/smilewanted.go b/adapters/smilewanted/smilewanted.go index 93278c2c25e..37a4128ba75 100644 --- a/adapters/smilewanted/smilewanted.go +++ b/adapters/smilewanted/smilewanted.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/sonobi/sonobi.go b/adapters/sonobi/sonobi.go index f85e6959464..385149f1517 100644 --- a/adapters/sonobi/sonobi.go +++ b/adapters/sonobi/sonobi.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/sovrn/sovrn.go b/adapters/sovrn/sovrn.go index 849e9c0b5d0..af60497f93e 100644 --- a/adapters/sovrn/sovrn.go +++ b/adapters/sovrn/sovrn.go @@ -13,7 +13,7 @@ import ( "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) type SovrnAdapter struct { diff --git a/adapters/sovrnXsp/sovrnXsp.go b/adapters/sovrnXsp/sovrnXsp.go index a026f888c72..8fe24ea1244 100644 --- a/adapters/sovrnXsp/sovrnXsp.go +++ b/adapters/sovrnXsp/sovrnXsp.go @@ -10,7 +10,7 @@ import ( "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) type adapter struct { diff --git a/adapters/sspBC/sspbc.go b/adapters/sspBC/sspbc.go index f1a91322999..e312b288bad 100644 --- a/adapters/sspBC/sspbc.go +++ b/adapters/sspBC/sspbc.go @@ -10,7 +10,7 @@ import ( "net/url" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/stroeerCore/stroeercore.go b/adapters/stroeerCore/stroeercore.go index 590e641ff1f..733d549e907 100644 --- a/adapters/stroeerCore/stroeercore.go +++ b/adapters/stroeerCore/stroeercore.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/taboola/taboola.go b/adapters/taboola/taboola.go index 8f4e6220143..85a129eb341 100644 --- a/adapters/taboola/taboola.go +++ b/adapters/taboola/taboola.go @@ -8,8 +8,8 @@ import ( "strings" "text/template" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/tappx/tappx.go b/adapters/tappx/tappx.go index d05a59316ae..a0343ccd78d 100644 --- a/adapters/tappx/tappx.go +++ b/adapters/tappx/tappx.go @@ -10,7 +10,7 @@ import ( "text/template" "time" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/teads/teads.go b/adapters/teads/teads.go index 72ee97f5a6e..9eaaad4fd2d 100644 --- a/adapters/teads/teads.go +++ b/adapters/teads/teads.go @@ -8,7 +8,7 @@ import ( "strconv" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/telaria/telaria.go b/adapters/telaria/telaria.go index a1ac5611e1f..ba2d10ae50a 100644 --- a/adapters/telaria/telaria.go +++ b/adapters/telaria/telaria.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/tpmn/tpmn.go b/adapters/tpmn/tpmn.go index 443b8837bac..68f4dc50a5d 100644 --- a/adapters/tpmn/tpmn.go +++ b/adapters/tpmn/tpmn.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/trafficgate/trafficgate.go b/adapters/trafficgate/trafficgate.go index 1462fe59bd5..b7ae0356a95 100644 --- a/adapters/trafficgate/trafficgate.go +++ b/adapters/trafficgate/trafficgate.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 793647bccaa..080fe326362 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/triplelift_native/triplelift_native.go b/adapters/triplelift_native/triplelift_native.go index 08aefb3b135..64934ca0869 100644 --- a/adapters/triplelift_native/triplelift_native.go +++ b/adapters/triplelift_native/triplelift_native.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/ucfunnel/ucfunnel.go b/adapters/ucfunnel/ucfunnel.go index cb4a6093c99..5ff65599b30 100644 --- a/adapters/ucfunnel/ucfunnel.go +++ b/adapters/ucfunnel/ucfunnel.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/ucfunnel/ucfunnel_test.go b/adapters/ucfunnel/ucfunnel_test.go index 6e5000c3205..cc81f4715e6 100644 --- a/adapters/ucfunnel/ucfunnel_test.go +++ b/adapters/ucfunnel/ucfunnel_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/undertone/undertone.go b/adapters/undertone/undertone.go index a5f428b12ca..fa960aac976 100644 --- a/adapters/undertone/undertone.go +++ b/adapters/undertone/undertone.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" diff --git a/adapters/unicorn/unicorn.go b/adapters/unicorn/unicorn.go index 6351ad059cf..fb9a6069319 100644 --- a/adapters/unicorn/unicorn.go +++ b/adapters/unicorn/unicorn.go @@ -7,7 +7,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/unruly/unruly.go b/adapters/unruly/unruly.go index b96da9eb93e..6a9c55cc561 100644 --- a/adapters/unruly/unruly.go +++ b/adapters/unruly/unruly.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/videobyte/videobyte.go b/adapters/videobyte/videobyte.go index afbce1376f9..7a4bebc3a41 100644 --- a/adapters/videobyte/videobyte.go +++ b/adapters/videobyte/videobyte.go @@ -11,7 +11,7 @@ import ( "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) type adapter struct { diff --git a/adapters/videoheroes/videoheroes.go b/adapters/videoheroes/videoheroes.go index 0014c1613e4..8999d4d0736 100755 --- a/adapters/videoheroes/videoheroes.go +++ b/adapters/videoheroes/videoheroes.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/vidoomy/vidoomy.go b/adapters/vidoomy/vidoomy.go index 09e924e596c..f96d577d719 100644 --- a/adapters/vidoomy/vidoomy.go +++ b/adapters/vidoomy/vidoomy.go @@ -5,12 +5,13 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) type adapter struct { @@ -97,8 +98,8 @@ func changeRequestForBidService(request *openrtb2.BidRequest) error { return fmt.Errorf("no sizes provided for Banner %v", banner.Format) } - banner.W = openrtb2.Int64Ptr(banner.Format[0].W) - banner.H = openrtb2.Int64Ptr(banner.Format[0].H) + banner.W = ptrutil.ToPtr(banner.Format[0].W) + banner.H = ptrutil.ToPtr(banner.Format[0].H) return nil } diff --git a/adapters/visiblemeasures/visiblemeasures.go b/adapters/visiblemeasures/visiblemeasures.go index 7b8cb9a9dd3..4973d33d377 100644 --- a/adapters/visiblemeasures/visiblemeasures.go +++ b/adapters/visiblemeasures/visiblemeasures.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/visx/visx.go b/adapters/visx/visx.go index a7cc232c01a..aa1707cfff2 100644 --- a/adapters/visx/visx.go +++ b/adapters/visx/visx.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/vox/vox.go b/adapters/vox/vox.go index 740fe84e611..73e60b31191 100644 --- a/adapters/vox/vox.go +++ b/adapters/vox/vox.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/adapters/vrtcal/vrtcal.go b/adapters/vrtcal/vrtcal.go index 01ef178b352..f97d555f363 100644 --- a/adapters/vrtcal/vrtcal.go +++ b/adapters/vrtcal/vrtcal.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/xeworks/xeworks.go b/adapters/xeworks/xeworks.go index e892fcfc932..ab1d68ca543 100644 --- a/adapters/xeworks/xeworks.go +++ b/adapters/xeworks/xeworks.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/yahooAds/yahooAds.go b/adapters/yahooAds/yahooAds.go index 241f4eba506..e99cf2e9f74 100644 --- a/adapters/yahooAds/yahooAds.go +++ b/adapters/yahooAds/yahooAds.go @@ -5,11 +5,12 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) type adapter struct { @@ -212,8 +213,8 @@ func validateBanner(banner *openrtb2.Banner) error { return fmt.Errorf("No sizes provided for Banner %v", banner.Format) } - banner.W = openrtb2.Int64Ptr(banner.Format[0].W) - banner.H = openrtb2.Int64Ptr(banner.Format[0].H) + banner.W = ptrutil.ToPtr(banner.Format[0].W) + banner.H = ptrutil.ToPtr(banner.Format[0].H) return nil } diff --git a/adapters/yandex/yandex.go b/adapters/yandex/yandex.go index 23f90f7954e..6d5dae82224 100644 --- a/adapters/yandex/yandex.go +++ b/adapters/yandex/yandex.go @@ -9,7 +9,7 @@ import ( "strings" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/yeahmobi/yeahmobi.go b/adapters/yeahmobi/yeahmobi.go index 35434d05473..1c14d997684 100644 --- a/adapters/yeahmobi/yeahmobi.go +++ b/adapters/yeahmobi/yeahmobi.go @@ -7,7 +7,7 @@ import ( "net/url" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/yieldlab/yieldlab.go b/adapters/yieldlab/yieldlab.go index c6aa7f27dac..744a45ae3ec 100644 --- a/adapters/yieldlab/yieldlab.go +++ b/adapters/yieldlab/yieldlab.go @@ -11,11 +11,12 @@ import ( "golang.org/x/text/currency" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) // YieldlabAdapter connects the Yieldlab API to prebid server @@ -66,8 +67,8 @@ func (a *YieldlabAdapter) makeEndpointURL(req *openrtb2.BidRequest, params *open } if req.Device.Geo != nil { - q.Set("lat", fmt.Sprintf("%v", req.Device.Geo.Lat)) - q.Set("lon", fmt.Sprintf("%v", req.Device.Geo.Lon)) + q.Set("lat", fmt.Sprintf("%v", ptrutil.ValueOrDefault(req.Device.Geo.Lat))) + q.Set("lon", fmt.Sprintf("%v", ptrutil.ValueOrDefault(req.Device.Geo.Lon))) } } diff --git a/adapters/yieldlab/yieldlab_test.go b/adapters/yieldlab/yieldlab_test.go index 4c4f8f56330..7704c8862fb 100644 --- a/adapters/yieldlab/yieldlab_test.go +++ b/adapters/yieldlab/yieldlab_test.go @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" "github.com/prebid/prebid-server/v2/adapters/adapterstest" diff --git a/adapters/yieldmo/yieldmo.go b/adapters/yieldmo/yieldmo.go index 69841e88a22..1d2ad308a2c 100644 --- a/adapters/yieldmo/yieldmo.go +++ b/adapters/yieldmo/yieldmo.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/yieldone/yieldone.go b/adapters/yieldone/yieldone.go index e852c5cb6ba..1431396413d 100644 --- a/adapters/yieldone/yieldone.go +++ b/adapters/yieldone/yieldone.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/zeroclickfraud/zeroclickfraud.go b/adapters/zeroclickfraud/zeroclickfraud.go index 6f477352652..6f416d96785 100644 --- a/adapters/zeroclickfraud/zeroclickfraud.go +++ b/adapters/zeroclickfraud/zeroclickfraud.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/zeta_global_ssp/zeta_global_ssp.go b/adapters/zeta_global_ssp/zeta_global_ssp.go index dcfffc8b342..59af0d4d75a 100644 --- a/adapters/zeta_global_ssp/zeta_global_ssp.go +++ b/adapters/zeta_global_ssp/zeta_global_ssp.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/adapters/zmaticoo/zmaticoo.go b/adapters/zmaticoo/zmaticoo.go index b5c85c4798a..8460f232fad 100644 --- a/adapters/zmaticoo/zmaticoo.go +++ b/adapters/zmaticoo/zmaticoo.go @@ -3,12 +3,13 @@ package zmaticoo import ( "encoding/json" "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "net/http" + + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" - "net/http" ) type adapter struct { diff --git a/adservertargeting/adservertargeting.go b/adservertargeting/adservertargeting.go index e79b521e1f5..d53af49f36c 100644 --- a/adservertargeting/adservertargeting.go +++ b/adservertargeting/adservertargeting.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" ) diff --git a/adservertargeting/adservertargeting_test.go b/adservertargeting/adservertargeting_test.go index d0a90ce0813..14daa0beb26 100644 --- a/adservertargeting/adservertargeting_test.go +++ b/adservertargeting/adservertargeting_test.go @@ -5,8 +5,8 @@ import ( "net/url" "testing" - "github.com/prebid/openrtb/v19/openrtb2" - "github.com/prebid/openrtb/v19/openrtb3" + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/openrtb/v20/openrtb3" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/jsonutil" "github.com/stretchr/testify/assert" diff --git a/adservertargeting/reqcache.go b/adservertargeting/reqcache.go index f2a4636c2f8..dfe429d5056 100644 --- a/adservertargeting/reqcache.go +++ b/adservertargeting/reqcache.go @@ -4,7 +4,7 @@ import ( "encoding/json" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/util/jsonutil" ) diff --git a/adservertargeting/requestcache_test.go b/adservertargeting/requestcache_test.go index cbafe0f44eb..248f11a8441 100644 --- a/adservertargeting/requestcache_test.go +++ b/adservertargeting/requestcache_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/adservertargeting/requestlookup_test.go b/adservertargeting/requestlookup_test.go index 1b54beb03e7..3de9bd72322 100644 --- a/adservertargeting/requestlookup_test.go +++ b/adservertargeting/requestlookup_test.go @@ -5,7 +5,7 @@ import ( "net/url" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adservertargeting/respdataprocessor.go b/adservertargeting/respdataprocessor.go index ab3ca070f89..5ec305c1451 100644 --- a/adservertargeting/respdataprocessor.go +++ b/adservertargeting/respdataprocessor.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/pkg/errors" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/jsonutil" jsonpatch "gopkg.in/evanphx/json-patch.v4" diff --git a/adservertargeting/respdataprocessor_test.go b/adservertargeting/respdataprocessor_test.go index 95404cef733..6970cfaceac 100644 --- a/adservertargeting/respdataprocessor_test.go +++ b/adservertargeting/respdataprocessor_test.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - "github.com/prebid/openrtb/v19/openrtb2" - "github.com/prebid/openrtb/v19/openrtb3" + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/openrtb/v20/openrtb3" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/amp/parse.go b/amp/parse.go index a42ef6fa399..54dcc8e0df3 100644 --- a/amp/parse.go +++ b/amp/parse.go @@ -9,7 +9,7 @@ import ( tcf2 "github.com/prebid/go-gdpr/vendorconsent/tcf2" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/privacy" "github.com/prebid/prebid-server/v2/privacy/ccpa" diff --git a/amp/parse_test.go b/amp/parse_test.go index 38c7a05a615..a377c4711fb 100644 --- a/amp/parse_test.go +++ b/amp/parse_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/privacy" "github.com/prebid/prebid-server/v2/privacy/ccpa" diff --git a/analytics/build/build_test.go b/analytics/build/build_test.go index d6fea975eda..d9b433cec4b 100644 --- a/analytics/build/build_test.go +++ b/analytics/build/build_test.go @@ -8,7 +8,7 @@ import ( "os" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/analytics" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/privacy" diff --git a/analytics/core.go b/analytics/core.go index 122a3da8ad3..c9e15180f44 100644 --- a/analytics/core.go +++ b/analytics/core.go @@ -3,7 +3,7 @@ package analytics import ( "time" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/hooks/hookexecution" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/analytics/filesystem/file_module.go b/analytics/filesystem/file_module.go index 4f7886c1206..01f9c27bf43 100644 --- a/analytics/filesystem/file_module.go +++ b/analytics/filesystem/file_module.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/chasex/glog" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/analytics" "github.com/prebid/prebid-server/v2/util/jsonutil" ) diff --git a/analytics/filesystem/file_module_test.go b/analytics/filesystem/file_module_test.go index f2f81bcdf77..0e0831d14f1 100644 --- a/analytics/filesystem/file_module_test.go +++ b/analytics/filesystem/file_module_test.go @@ -9,7 +9,7 @@ import ( "github.com/prebid/prebid-server/v2/analytics" "github.com/prebid/prebid-server/v2/config" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) const TEST_DIR string = "testFiles" diff --git a/analytics/filesystem/model.go b/analytics/filesystem/model.go index 61987ed3b53..013a92593a4 100644 --- a/analytics/filesystem/model.go +++ b/analytics/filesystem/model.go @@ -3,7 +3,7 @@ package filesystem import ( "time" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/analytics" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/hooks/hookexecution" diff --git a/analytics/pubstack/helpers/json.go b/analytics/pubstack/helpers/json.go index c516cb56ae8..c46393cbed8 100644 --- a/analytics/pubstack/helpers/json.go +++ b/analytics/pubstack/helpers/json.go @@ -3,7 +3,7 @@ package helpers import ( "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/analytics" "github.com/prebid/prebid-server/v2/util/jsonutil" ) diff --git a/analytics/pubstack/helpers/json_test.go b/analytics/pubstack/helpers/json_test.go index 7ec46e53f83..79055d16eb5 100644 --- a/analytics/pubstack/helpers/json_test.go +++ b/analytics/pubstack/helpers/json_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/analytics" "github.com/stretchr/testify/assert" ) diff --git a/analytics/pubstack/helpers/model.go b/analytics/pubstack/helpers/model.go index 1d6ede1c59b..2af6a19e439 100644 --- a/analytics/pubstack/helpers/model.go +++ b/analytics/pubstack/helpers/model.go @@ -3,7 +3,7 @@ package helpers import ( "time" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/analytics" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/hooks/hookexecution" diff --git a/bidadjustment/apply_test.go b/bidadjustment/apply_test.go index a1fa9f7c486..3fa46b6bcb2 100644 --- a/bidadjustment/apply_test.go +++ b/bidadjustment/apply_test.go @@ -3,7 +3,7 @@ package bidadjustment import ( "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" diff --git a/bidadjustment/build_rules_test.go b/bidadjustment/build_rules_test.go index 9ae1b477e8f..b3a9a930559 100644 --- a/bidadjustment/build_rules_test.go +++ b/bidadjustment/build_rules_test.go @@ -3,7 +3,7 @@ package bidadjustment import ( "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" diff --git a/config/config.go b/config/config.go index 60a541e2ed0..f0e9f5c7fa7 100644 --- a/config/config.go +++ b/config/config.go @@ -11,7 +11,7 @@ import ( "github.com/golang/glog" "github.com/prebid/go-gdpr/consentconstants" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/jsonutil" diff --git a/endpoints/openrtb2/amp_auction.go b/endpoints/openrtb2/amp_auction.go index ab93ad3c29d..a6ad8d3fc65 100644 --- a/endpoints/openrtb2/amp_auction.go +++ b/endpoints/openrtb2/amp_auction.go @@ -14,8 +14,8 @@ import ( "github.com/buger/jsonparser" "github.com/golang/glog" "github.com/julienschmidt/httprouter" - "github.com/prebid/openrtb/v19/openrtb2" - "github.com/prebid/openrtb/v19/openrtb3" + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/openrtb/v20/openrtb3" "github.com/prebid/prebid-server/v2/hooks/hookexecution" "github.com/prebid/prebid-server/v2/ortb" "github.com/prebid/prebid-server/v2/util/uuidutil" diff --git a/endpoints/openrtb2/amp_auction_test.go b/endpoints/openrtb2/amp_auction_test.go index bd56457b3d7..7d87b65301d 100644 --- a/endpoints/openrtb2/amp_auction_test.go +++ b/endpoints/openrtb2/amp_auction_test.go @@ -14,7 +14,7 @@ import ( "time" "github.com/julienschmidt/httprouter" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index ff5e54688a4..47a402e620d 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -20,11 +20,11 @@ import ( "github.com/julienschmidt/httprouter" gpplib "github.com/prebid/go-gpp" "github.com/prebid/go-gpp/constants" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/native1" - nativeRequests "github.com/prebid/openrtb/v19/native1/request" - "github.com/prebid/openrtb/v19/openrtb2" - "github.com/prebid/openrtb/v19/openrtb3" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/native1" + nativeRequests "github.com/prebid/openrtb/v20/native1/request" + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/openrtb/v20/openrtb3" "github.com/prebid/prebid-server/v2/bidadjustment" "github.com/prebid/prebid-server/v2/hooks" "github.com/prebid/prebid-server/v2/ortb" @@ -1146,10 +1146,10 @@ func validateVideo(video *openrtb2.Video, impIndex int) error { // The following fields were previously uints in the OpenRTB library we use, but have // since been changed to ints. We decided to maintain the non-negative check. - if video.W < 0 { + if video.W != nil && *video.W < 0 { return fmt.Errorf("request.imp[%d].video.w must be a positive number", impIndex) } - if video.H < 0 { + if video.H != nil && *video.H < 0 { return fmt.Errorf("request.imp[%d].video.h must be a positive number", impIndex) } if video.MinBitRate < 0 { diff --git a/endpoints/openrtb2/auction_test.go b/endpoints/openrtb2/auction_test.go index c521d653cac..a9e16c9490b 100644 --- a/endpoints/openrtb2/auction_test.go +++ b/endpoints/openrtb2/auction_test.go @@ -19,9 +19,9 @@ import ( "github.com/buger/jsonparser" "github.com/julienschmidt/httprouter" - "github.com/prebid/openrtb/v19/native1" - nativeRequests "github.com/prebid/openrtb/v19/native1/request" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/native1" + nativeRequests "github.com/prebid/openrtb/v20/native1/request" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/analytics" analyticsBuild "github.com/prebid/prebid-server/v2/analytics/build" "github.com/prebid/prebid-server/v2/config" diff --git a/endpoints/openrtb2/interstitial.go b/endpoints/openrtb2/interstitial.go index 330119b6f8f..a1af3e4721f 100644 --- a/endpoints/openrtb2/interstitial.go +++ b/endpoints/openrtb2/interstitial.go @@ -3,7 +3,7 @@ package openrtb2 import ( "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/endpoints/openrtb2/interstitial_test.go b/endpoints/openrtb2/interstitial_test.go index eb69bc91f08..6373d18407b 100644 --- a/endpoints/openrtb2/interstitial_test.go +++ b/endpoints/openrtb2/interstitial_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/openrtb2/test_utils.go b/endpoints/openrtb2/test_utils.go index a0ac836e30e..6fedb73cd47 100644 --- a/endpoints/openrtb2/test_utils.go +++ b/endpoints/openrtb2/test_utils.go @@ -16,8 +16,8 @@ import ( "github.com/buger/jsonparser" "github.com/julienschmidt/httprouter" - "github.com/prebid/openrtb/v19/openrtb2" - "github.com/prebid/openrtb/v19/openrtb3" + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/openrtb/v20/openrtb3" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/analytics" analyticsBuild "github.com/prebid/prebid-server/v2/analytics/build" diff --git a/endpoints/openrtb2/video_auction.go b/endpoints/openrtb2/video_auction.go index 05802bbd506..22248f1f36c 100644 --- a/endpoints/openrtb2/video_auction.go +++ b/endpoints/openrtb2/video_auction.go @@ -16,7 +16,7 @@ import ( "github.com/gofrs/uuid" "github.com/golang/glog" "github.com/julienschmidt/httprouter" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/hooks" "github.com/prebid/prebid-server/v2/hooks/hookexecution" "github.com/prebid/prebid-server/v2/ortb" diff --git a/endpoints/openrtb2/video_auction_test.go b/endpoints/openrtb2/video_auction_test.go index 34606c1d051..98d6ca35c49 100644 --- a/endpoints/openrtb2/video_auction_test.go +++ b/endpoints/openrtb2/video_auction_test.go @@ -26,8 +26,8 @@ import ( "github.com/prebid/prebid-server/v2/util/jsonutil" "github.com/prebid/prebid-server/v2/util/ptrutil" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" gometrics "github.com/rcrowley/go-metrics" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -53,8 +53,8 @@ func TestVideoEndpointImpressionsNumber(t *testing.T) { } assert.Len(t, ex.lastRequest.Imp, 11, "Incorrect number of impressions in request") - assert.Equal(t, string(ex.lastRequest.Site.Page), "prebid.com", "Incorrect site page in request") - assert.Equal(t, ex.lastRequest.Site.Content.Series, "TvName", "Incorrect site content series in request") + assert.Equal(t, "prebid.com", string(ex.lastRequest.Site.Page), "Incorrect site page in request") + assert.Equal(t, "TvName", ex.lastRequest.Site.Content.Series, "Incorrect site content series in request") assert.Len(t, resp.AdPods, 5, "Incorrect number of Ad Pods in response") assert.Len(t, resp.AdPods[0].Targeting, 4, "Incorrect Targeting data in response") @@ -63,8 +63,8 @@ func TestVideoEndpointImpressionsNumber(t *testing.T) { assert.Len(t, resp.AdPods[3].Targeting, 1, "Incorrect Targeting data in response") assert.Len(t, resp.AdPods[4].Targeting, 3, "Incorrect Targeting data in response") - assert.Equal(t, resp.AdPods[4].Targeting[0].HbPbCatDur, "20.00_395_30s", "Incorrect number of Ad Pods in response") - assert.Equal(t, resp.AdPods[0].Targeting[0].HbDeal, "ABC_123", "If DealID exists in bid response, hb_deal targeting needs to be added to resp") + assert.Equal(t, "20.00_395_30s", resp.AdPods[4].Targeting[0].HbPbCatDur, "Incorrect number of Ad Pods in response") + assert.Equal(t, "ABC_123", resp.AdPods[0].Targeting[0].HbDeal, "If DealID exists in bid response, hb_deal targeting needs to be added to resp") } func TestVideoEndpointImpressionsDuration(t *testing.T) { @@ -86,21 +86,21 @@ func TestVideoEndpointImpressionsDuration(t *testing.T) { assert.True(t, *extData.Prebid.Targeting.IncludeBidderKeys, "Request ext incorrect: IncludeBidderKeys should be true ") assert.Len(t, ex.lastRequest.Imp, 22, "Incorrect number of impressions in request") - assert.Equal(t, ex.lastRequest.Imp[0].ID, "1_0", "Incorrect impression id in request") - assert.Equal(t, ex.lastRequest.Imp[0].Video.MaxDuration, int64(15), "Incorrect impression max duration in request") - assert.Equal(t, ex.lastRequest.Imp[0].Video.MinDuration, int64(15), "Incorrect impression min duration in request") + assert.Equal(t, "1_0", ex.lastRequest.Imp[0].ID, "Incorrect impression id in request") + assert.Equal(t, int64(15), ex.lastRequest.Imp[0].Video.MaxDuration, "Incorrect impression max duration in request") + assert.Equal(t, int64(15), ex.lastRequest.Imp[0].Video.MinDuration, "Incorrect impression min duration in request") - assert.Equal(t, ex.lastRequest.Imp[6].ID, "1_6", "Incorrect impression id in request") - assert.Equal(t, ex.lastRequest.Imp[6].Video.MaxDuration, int64(30), "Incorrect impression max duration in request") - assert.Equal(t, ex.lastRequest.Imp[6].Video.MinDuration, int64(30), "Incorrect impression min duration in request") + assert.Equal(t, "1_6", ex.lastRequest.Imp[6].ID, "Incorrect impression id in request") + assert.Equal(t, int64(30), ex.lastRequest.Imp[6].Video.MaxDuration, "Incorrect impression max duration in request") + assert.Equal(t, int64(30), ex.lastRequest.Imp[6].Video.MinDuration, "Incorrect impression min duration in request") - assert.Equal(t, ex.lastRequest.Imp[12].ID, "2_0", "Incorrect impression id in request") - assert.Equal(t, ex.lastRequest.Imp[12].Video.MaxDuration, int64(15), "Incorrect impression max duration in request") - assert.Equal(t, ex.lastRequest.Imp[12].Video.MinDuration, int64(15), "Incorrect impression min duration in request") + assert.Equal(t, "2_0", ex.lastRequest.Imp[12].ID, "Incorrect impression id in request") + assert.Equal(t, int64(15), ex.lastRequest.Imp[12].Video.MaxDuration, "Incorrect impression max duration in request") + assert.Equal(t, int64(15), ex.lastRequest.Imp[12].Video.MinDuration, "Incorrect impression min duration in request") - assert.Equal(t, ex.lastRequest.Imp[17].ID, "2_5", "Incorrect impression id in request") - assert.Equal(t, ex.lastRequest.Imp[17].Video.MaxDuration, int64(30), "Incorrect impression max duration in request") - assert.Equal(t, ex.lastRequest.Imp[17].Video.MinDuration, int64(30), "Incorrect impression min duration in request") + assert.Equal(t, "2_5", ex.lastRequest.Imp[17].ID, "Incorrect impression id in request") + assert.Equal(t, int64(30), ex.lastRequest.Imp[17].Video.MaxDuration, "Incorrect impression max duration in request") + assert.Equal(t, int64(30), ex.lastRequest.Imp[17].Video.MinDuration, "Incorrect impression min duration in request") } func TestCreateBidExtension(t *testing.T) { @@ -139,8 +139,8 @@ func TestCreateBidExtension(t *testing.T) { if err := jsonutil.UnmarshalValid(res, &resExt); err != nil { assert.Fail(t, "Unable to unmarshal bid extension") } - assert.Equal(t, resExt.Prebid.Targeting.DurationRangeSec, durationRange, "Duration range seconds is incorrect") - assert.Equal(t, resExt.Prebid.Targeting.PriceGranularity.Ranges, priceGranRanges, "Price granularity is incorrect") + assert.Equal(t, durationRange, resExt.Prebid.Targeting.DurationRangeSec, "Duration range seconds is incorrect") + assert.Equal(t, priceGranRanges, resExt.Prebid.Targeting.PriceGranularity.Ranges, "Price granularity is incorrect") } func TestCreateBidExtensionTargeting(t *testing.T) { @@ -184,8 +184,8 @@ func TestVideoEndpointDebugQueryTrue(t *testing.T) { } assert.Len(t, ex.lastRequest.Imp, 11, "Incorrect number of impressions in request") - assert.Equal(t, string(ex.lastRequest.Site.Page), "prebid.com", "Incorrect site page in request") - assert.Equal(t, ex.lastRequest.Site.Content.Series, "TvName", "Incorrect site content series in request") + assert.Equal(t, "prebid.com", string(ex.lastRequest.Site.Page), "Incorrect site page in request") + assert.Equal(t, "TvName", ex.lastRequest.Site.Content.Series, "Incorrect site content series in request") assert.Len(t, resp.AdPods, 5, "Incorrect number of Ad Pods in response") assert.Len(t, resp.AdPods[0].Targeting, 4, "Incorrect Targeting data in response") @@ -194,7 +194,7 @@ func TestVideoEndpointDebugQueryTrue(t *testing.T) { assert.Len(t, resp.AdPods[3].Targeting, 1, "Incorrect Targeting data in response") assert.Len(t, resp.AdPods[4].Targeting, 3, "Incorrect Targeting data in response") - assert.Equal(t, resp.AdPods[4].Targeting[0].HbPbCatDur, "20.00_395_30s", "Incorrect number of Ad Pods in response") + assert.Equal(t, "20.00_395_30s", resp.AdPods[4].Targeting[0].HbPbCatDur, "Incorrect number of Ad Pods in response") } func TestVideoEndpointDebugQueryFalse(t *testing.T) { @@ -222,8 +222,8 @@ func TestVideoEndpointDebugQueryFalse(t *testing.T) { } assert.Len(t, ex.lastRequest.Imp, 11, "Incorrect number of impressions in request") - assert.Equal(t, string(ex.lastRequest.Site.Page), "prebid.com", "Incorrect site page in request") - assert.Equal(t, ex.lastRequest.Site.Content.Series, "TvName", "Incorrect site content series in request") + assert.Equal(t, "prebid.com", string(ex.lastRequest.Site.Page), "Incorrect site page in request") + assert.Equal(t, "TvName", ex.lastRequest.Site.Content.Series, "Incorrect site content series in request") assert.Len(t, resp.AdPods, 5, "Incorrect number of Ad Pods in response") assert.Len(t, resp.AdPods[0].Targeting, 4, "Incorrect Targeting data in response") @@ -232,7 +232,7 @@ func TestVideoEndpointDebugQueryFalse(t *testing.T) { assert.Len(t, resp.AdPods[3].Targeting, 1, "Incorrect Targeting data in response") assert.Len(t, resp.AdPods[4].Targeting, 3, "Incorrect Targeting data in response") - assert.Equal(t, resp.AdPods[4].Targeting[0].HbPbCatDur, "20.00_395_30s", "Incorrect number of Ad Pods in response") + assert.Equal(t, "20.00_395_30s", resp.AdPods[4].Targeting[0].HbPbCatDur, "Incorrect number of Ad Pods in response") } func TestVideoEndpointDebugError(t *testing.T) { @@ -250,7 +250,7 @@ func TestVideoEndpointDebugError(t *testing.T) { t.Fatalf("Cache was not called when it should have been") } - assert.Equal(t, recorder.Code, 500, "Should catch error in request") + assert.Equal(t, 500, recorder.Code, "Should catch error in request") } func TestVideoEndpointDebugNoAdPods(t *testing.T) { @@ -296,7 +296,7 @@ func TestVideoEndpointNoPods(t *testing.T) { errorMessage := recorder.Body.String() - assert.Equal(t, recorder.Code, 500, "Should catch error in request") + assert.Equal(t, 500, recorder.Code, "Should catch error in request") assert.Equal(t, "Critical error while running the video endpoint: request missing required field: PodConfig.DurationRangeSec request missing required field: PodConfig.Pods", errorMessage, "Incorrect request validation message") } @@ -1026,28 +1026,27 @@ func TestHandleErrorDebugLog(t *testing.T) { } func TestCreateImpressionTemplate(t *testing.T) { - imp := openrtb2.Imp{} imp.Video = &openrtb2.Video{} imp.Video.Protocols = []adcom1.MediaCreativeSubtype{1, 2} imp.Video.MIMEs = []string{"video/mp4"} - imp.Video.H = 200 - imp.Video.W = 400 + imp.Video.H = ptrutil.ToPtr[int64](200) + imp.Video.W = ptrutil.ToPtr[int64](400) imp.Video.PlaybackMethod = []adcom1.PlaybackMethod{5, 6} video := openrtb2.Video{} video.Protocols = []adcom1.MediaCreativeSubtype{3, 4} video.MIMEs = []string{"video/flv"} - video.H = 300 - video.W = 0 + video.H = ptrutil.ToPtr[int64](300) + video.W = ptrutil.ToPtr[int64](0) video.PlaybackMethod = []adcom1.PlaybackMethod{7, 8} res := createImpressionTemplate(imp, &video) - assert.Equal(t, res.Video.Protocols, []adcom1.MediaCreativeSubtype{3, 4}, "Incorrect video protocols") - assert.Equal(t, res.Video.MIMEs, []string{"video/flv"}, "Incorrect video MIMEs") - assert.Equal(t, int(res.Video.H), 300, "Incorrect video height") - assert.Equal(t, int(res.Video.W), 0, "Incorrect video width") - assert.Equal(t, res.Video.PlaybackMethod, []adcom1.PlaybackMethod{7, 8}, "Incorrect video playback method") + assert.Equal(t, []adcom1.MediaCreativeSubtype{3, 4}, res.Video.Protocols, "Incorrect video protocols") + assert.Equal(t, []string{"video/flv"}, res.Video.MIMEs, "Incorrect video MIMEs") + assert.Equal(t, ptrutil.ToPtr[int64](300), res.Video.H, "Incorrect video height") + assert.Equal(t, ptrutil.ToPtr[int64](0), res.Video.W, "Incorrect video width") + assert.Equal(t, []adcom1.PlaybackMethod{7, 8}, res.Video.PlaybackMethod, "Incorrect video playback method") } func TestCCPA(t *testing.T) { @@ -1136,8 +1135,8 @@ func TestVideoEndpointAppendBidderNames(t *testing.T) { } assert.Len(t, ex.lastRequest.Imp, 11, "Incorrect number of impressions in request") - assert.Equal(t, string(ex.lastRequest.Site.Page), "prebid.com", "Incorrect site page in request") - assert.Equal(t, ex.lastRequest.Site.Content.Series, "TvName", "Incorrect site content series in request") + assert.Equal(t, "prebid.com", string(ex.lastRequest.Site.Page), "Incorrect site page in request") + assert.Equal(t, "TvName", ex.lastRequest.Site.Content.Series, "Incorrect site content series in request") assert.Len(t, resp.AdPods, 5, "Incorrect number of Ad Pods in response") assert.Len(t, resp.AdPods[0].Targeting, 4, "Incorrect Targeting data in response") @@ -1146,7 +1145,7 @@ func TestVideoEndpointAppendBidderNames(t *testing.T) { assert.Len(t, resp.AdPods[3].Targeting, 1, "Incorrect Targeting data in response") assert.Len(t, resp.AdPods[4].Targeting, 3, "Incorrect Targeting data in response") - assert.Equal(t, resp.AdPods[4].Targeting[0].HbPbCatDur, "20.00_395_30s_appnexus", "Incorrect number of Ad Pods in response") + assert.Equal(t, "20.00_395_30s_appnexus", resp.AdPods[4].Targeting[0].HbPbCatDur, "Incorrect number of Ad Pods in response") } func TestFormatTargetingKey(t *testing.T) { diff --git a/exchange/adapter_util_test.go b/exchange/adapter_util_test.go index 8f765305248..053b669961d 100644 --- a/exchange/adapter_util_test.go +++ b/exchange/adapter_util_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/appnexus" "github.com/prebid/prebid-server/v2/adapters/rubicon" diff --git a/exchange/auction.go b/exchange/auction.go index 17a843fb5ed..c02e9141c7a 100644 --- a/exchange/auction.go +++ b/exchange/auction.go @@ -11,7 +11,7 @@ import ( "time" uuid "github.com/gofrs/uuid" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/exchange/entities" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/exchange/auction_response.go b/exchange/auction_response.go index c92798d0f3b..1d0747b0fe5 100644 --- a/exchange/auction_response.go +++ b/exchange/auction_response.go @@ -1,7 +1,7 @@ package exchange import ( - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" ) diff --git a/exchange/auction_test.go b/exchange/auction_test.go index 10c4b9a5e67..40b1aba9e98 100644 --- a/exchange/auction_test.go +++ b/exchange/auction_test.go @@ -11,7 +11,7 @@ import ( "strconv" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/exchange/entities" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/exchange/bidder.go b/exchange/bidder.go index ebe1d5d384b..baab39b6daf 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -25,10 +25,10 @@ import ( "github.com/prebid/prebid-server/v2/hooks/hookexecution" "github.com/prebid/prebid-server/v2/version" - "github.com/prebid/openrtb/v19/adcom1" - nativeRequests "github.com/prebid/openrtb/v19/native1/request" - nativeResponse "github.com/prebid/openrtb/v19/native1/response" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + nativeRequests "github.com/prebid/openrtb/v20/native1/request" + nativeResponse "github.com/prebid/openrtb/v20/native1/response" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/exchange/bidder_test.go b/exchange/bidder_test.go index d3af2a46e91..a1662ab7128 100644 --- a/exchange/bidder_test.go +++ b/exchange/bidder_test.go @@ -18,10 +18,10 @@ import ( "time" "github.com/golang/glog" - "github.com/prebid/openrtb/v19/adcom1" - nativeRequests "github.com/prebid/openrtb/v19/native1/request" - nativeResponse "github.com/prebid/openrtb/v19/native1/response" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + nativeRequests "github.com/prebid/openrtb/v20/native1/request" + nativeResponse "github.com/prebid/openrtb/v20/native1/response" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/currency" @@ -33,6 +33,7 @@ import ( metricsConfig "github.com/prebid/prebid-server/v2/metrics/config" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/jsonutil" + "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/prebid/prebid-server/v2/version" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -1880,7 +1881,7 @@ func TestSetAssetTypes(t *testing.T) { }{ { respAsset: nativeResponse.Asset{ - ID: openrtb2.Int64Ptr(1), + ID: ptrutil.ToPtr[int64](1), Img: &nativeResponse.Image{ URL: "http://some-url", }, @@ -1906,7 +1907,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: openrtb2.Int64Ptr(2), + ID: ptrutil.ToPtr[int64](2), Data: &nativeResponse.Data{ Label: "some label", }, @@ -1932,7 +1933,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: openrtb2.Int64Ptr(1), + ID: ptrutil.ToPtr[int64](1), Img: &nativeResponse.Image{ URL: "http://some-url", }, @@ -1952,7 +1953,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: openrtb2.Int64Ptr(2), + ID: ptrutil.ToPtr[int64](2), Data: &nativeResponse.Data{ Label: "some label", }, @@ -1972,7 +1973,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: openrtb2.Int64Ptr(1), + ID: ptrutil.ToPtr[int64](1), Img: &nativeResponse.Image{ URL: "http://some-url", }, diff --git a/exchange/bidder_validate_bids.go b/exchange/bidder_validate_bids.go index 651b2c0f420..9c22475a713 100644 --- a/exchange/bidder_validate_bids.go +++ b/exchange/bidder_validate_bids.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/currency" "github.com/prebid/prebid-server/v2/exchange/entities" diff --git a/exchange/bidder_validate_bids_test.go b/exchange/bidder_validate_bids_test.go index a495556f424..805eba9ad5b 100644 --- a/exchange/bidder_validate_bids_test.go +++ b/exchange/bidder_validate_bids_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/currency" "github.com/prebid/prebid-server/v2/exchange/entities" diff --git a/exchange/entities/entities.go b/exchange/entities/entities.go index f106003d8ca..0449f45684f 100644 --- a/exchange/entities/entities.go +++ b/exchange/entities/entities.go @@ -1,7 +1,7 @@ package entities import ( - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" ) diff --git a/exchange/events_test.go b/exchange/events_test.go index 3d191f5f63c..a4ed587cd67 100644 --- a/exchange/events_test.go +++ b/exchange/events_test.go @@ -3,7 +3,7 @@ package exchange import ( "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/exchange/entities" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" diff --git a/exchange/exchange.go b/exchange/exchange.go index 16f8017fb71..a5f4eb44481 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -41,8 +41,8 @@ import ( "github.com/buger/jsonparser" "github.com/gofrs/uuid" "github.com/golang/glog" - "github.com/prebid/openrtb/v19/openrtb2" - "github.com/prebid/openrtb/v19/openrtb3" + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/openrtb/v20/openrtb3" ) type extCacheInstructions struct { diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index 65ad7eeb188..fc7c7064b28 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -19,7 +19,7 @@ import ( "time" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/currency" @@ -1892,8 +1892,8 @@ func getTestBuildRequest(t *testing.T) *openrtb2.BidRequest { MIMEs: []string{"video/mp4"}, MinDuration: 1, MaxDuration: 300, - W: 300, - H: 600, + W: ptrutil.ToPtr[int64](300), + H: ptrutil.ToPtr[int64](600), }, Ext: json.RawMessage(`{"prebid":{"bidder":{"appnexus": {"placementId": 1}}}}`), }}, @@ -4109,7 +4109,7 @@ func TestStoredAuctionResponses(t *testing.T) { ID: "request-id", Imp: []openrtb2.Imp{{ ID: "impression-id", - Video: &openrtb2.Video{W: 400, H: 300}, + Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](400), H: ptrutil.ToPtr[int64](300)}, }}, } diff --git a/exchange/gdpr_test.go b/exchange/gdpr_test.go index 0e12ec66568..e9b11cc2cfb 100644 --- a/exchange/gdpr_test.go +++ b/exchange/gdpr_test.go @@ -6,7 +6,7 @@ import ( gpplib "github.com/prebid/go-gpp" gppConstants "github.com/prebid/go-gpp/constants" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/gdpr" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" diff --git a/exchange/price_granularity.go b/exchange/price_granularity.go index ee3104605d7..9c16a0d3aef 100644 --- a/exchange/price_granularity.go +++ b/exchange/price_granularity.go @@ -4,7 +4,7 @@ import ( "math" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" ) diff --git a/exchange/price_granularity_test.go b/exchange/price_granularity_test.go index 810dbcdf45a..82152acb9d2 100644 --- a/exchange/price_granularity_test.go +++ b/exchange/price_granularity_test.go @@ -5,7 +5,7 @@ import ( "math" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/stretchr/testify/assert" diff --git a/exchange/seat_non_bids_test.go b/exchange/seat_non_bids_test.go index 1a6b488b542..103c0939496 100644 --- a/exchange/seat_non_bids_test.go +++ b/exchange/seat_non_bids_test.go @@ -3,7 +3,7 @@ package exchange import ( "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/exchange/entities" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" diff --git a/exchange/targeting.go b/exchange/targeting.go index d278c2f5873..0047ba8b06e 100644 --- a/exchange/targeting.go +++ b/exchange/targeting.go @@ -4,7 +4,7 @@ import ( "fmt" "strconv" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" ) diff --git a/exchange/targeting_test.go b/exchange/targeting_test.go index 8742a4f5d2a..c124178e9c8 100644 --- a/exchange/targeting_test.go +++ b/exchange/targeting_test.go @@ -19,7 +19,7 @@ import ( "github.com/prebid/prebid-server/v2/util/jsonutil" "github.com/prebid/prebid-server/v2/util/ptrutil" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/exchange/utils.go b/exchange/utils.go index 53890718a1d..ab2cac7ef32 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -6,15 +6,16 @@ import ( "encoding/json" "errors" "fmt" - "github.com/prebid/prebid-server/v2/ortb" "math/rand" "strings" + "github.com/prebid/prebid-server/v2/ortb" + "github.com/buger/jsonparser" "github.com/prebid/go-gdpr/vendorconsent" gpplib "github.com/prebid/go-gpp" gppConstants "github.com/prebid/go-gpp/constants" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" @@ -181,7 +182,9 @@ func (rs *requestSplitter) cleanOpenRTBRequests(ctx context.Context, // FPD should be applied before policies, otherwise it overrides policies and activities restricted data applyFPD(auctionReq.FirstPartyData, bidderRequest) - reqWrapper := ortb.CloneBidderReq(bidderRequest.BidRequest) + reqWrapper := &openrtb_ext.RequestWrapper{ + BidRequest: ortb.CloneBidRequestPartial(bidderRequest.BidRequest), + } passIDActivityAllowed := auctionReq.Activities.Allow(privacy.ActivityTransmitUserFPD, scopedName, privacy.NewRequestFromBidRequest(*req)) if !passIDActivityAllowed { diff --git a/exchange/utils_test.go b/exchange/utils_test.go index 1e5213ab0b1..a6a7217d9be 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -12,7 +12,7 @@ import ( gpplib "github.com/prebid/go-gpp" "github.com/prebid/go-gpp/constants" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/firstpartydata" @@ -618,8 +618,8 @@ func TestCleanOpenRTBRequestsWithBidResponses(t *testing.T) { { ID: "imp-id1", Video: &openrtb2.Video{ - W: 300, - H: 250, + W: ptrutil.ToPtr[int64](300), + H: ptrutil.ToPtr[int64](250), }, Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"placementId":"123"}}}}`), }, @@ -642,8 +642,8 @@ func TestCleanOpenRTBRequestsWithBidResponses(t *testing.T) { { ID: "imp-id1", Video: &openrtb2.Video{ - W: 300, - H: 250, + W: ptrutil.ToPtr[int64](300), + H: ptrutil.ToPtr[int64](250), }, Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"placementId":"123"}}}}`), }, @@ -672,8 +672,8 @@ func TestCleanOpenRTBRequestsWithBidResponses(t *testing.T) { { ID: "imp-id1", Video: &openrtb2.Video{ - W: 300, - H: 250, + W: ptrutil.ToPtr[int64](300), + H: ptrutil.ToPtr[int64](250), }, Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"placementId":"123"}}}}`), }, @@ -703,8 +703,8 @@ func TestCleanOpenRTBRequestsWithBidResponses(t *testing.T) { { ID: "imp-id1", Video: &openrtb2.Video{ - W: 300, - H: 250, + W: ptrutil.ToPtr[int64](300), + H: ptrutil.ToPtr[int64](250), }, Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"placementId":"123"}}}}`), }, @@ -743,8 +743,8 @@ func TestCleanOpenRTBRequestsWithBidResponses(t *testing.T) { { ID: "imp-id1", Video: &openrtb2.Video{ - W: 300, - H: 250, + W: ptrutil.ToPtr[int64](300), + H: ptrutil.ToPtr[int64](250), }, Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"placementId":"123"}}}}`), }, @@ -2282,7 +2282,7 @@ func TestCleanOpenRTBRequestsWithOpenRTBDowngrade(t *testing.T) { bidReq.User.BuyerUID = "" bidReq.User.Yob = 0 bidReq.User.Gender = "" - bidReq.User.Geo = &openrtb2.Geo{Lat: 123.46} + bidReq.User.Geo = &openrtb2.Geo{Lat: ptrutil.ToPtr(123.46)} downgradedRegs := *bidReq.Regs downgradedUser := *bidReq.User @@ -2593,7 +2593,7 @@ func newBidRequest(t *testing.T) *openrtb2.BidRequest { DPIDSHA1: "DPIDSHA1", MACMD5: "MACMD5", MACSHA1: "MACSHA1", - Geo: &openrtb2.Geo{Lat: 123.456, Lon: 11.278}, + Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.456), Lon: ptrutil.ToPtr(11.278)}, }, Source: &openrtb2.Source{ TID: "testTID", @@ -2604,7 +2604,7 @@ func newBidRequest(t *testing.T) *openrtb2.BidRequest { Yob: 1982, Gender: "test", Ext: json.RawMessage(`{"data": 1, "test": 2}`), - Geo: &openrtb2.Geo{Lat: 123.456, Lon: 11.278}, + Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.456), Lon: ptrutil.ToPtr(11.278)}, EIDs: []openrtb2.EID{ {Source: "eids-source"}, }, @@ -4486,7 +4486,7 @@ func TestCleanOpenRTBRequestsActivities(t *testing.T) { Yob: 1982, Gender: "test", Ext: json.RawMessage(`{"data": 1, "test": 2}`), - Geo: &openrtb2.Geo{Lat: 123.456, Lon: 11.278}, + Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.456), Lon: ptrutil.ToPtr(11.278)}, EIDs: []openrtb2.EID{ {Source: "eids-source"}, }, @@ -4503,7 +4503,7 @@ func TestCleanOpenRTBRequestsActivities(t *testing.T) { DPIDSHA1: "DPIDSHA1", MACMD5: "MACMD5", MACSHA1: "MACSHA1", - Geo: &openrtb2.Geo{Lat: 123.456, Lon: 11.278}, + Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.456), Lon: ptrutil.ToPtr(11.278)}, } expectedSourceDefault := openrtb2.Source{ @@ -4560,7 +4560,7 @@ func TestCleanOpenRTBRequestsActivities(t *testing.T) { ID: "", BuyerUID: "", Yob: 0, - Geo: &openrtb2.Geo{Lat: 123.456, Lon: 11.278}, + Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.456), Lon: ptrutil.ToPtr(11.278)}, EIDs: nil, Ext: json.RawMessage(`{"test":2}`), Data: nil, @@ -4576,7 +4576,7 @@ func TestCleanOpenRTBRequestsActivities(t *testing.T) { DPIDSHA1: "", MACMD5: "", MACSHA1: "", - Geo: &openrtb2.Geo{Lat: 123.456, Lon: 11.278}, + Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.456), Lon: ptrutil.ToPtr(11.278)}, }, expectedSource: expectedSourceDefault, }, @@ -4600,7 +4600,7 @@ func TestCleanOpenRTBRequestsActivities(t *testing.T) { ID: "our-id", BuyerUID: "their-id", Yob: 1982, - Geo: &openrtb2.Geo{Lat: 123.46, Lon: 11.28}, + Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.46), Lon: ptrutil.ToPtr(11.28)}, Gender: "test", Ext: json.RawMessage(`{"data": 1, "test": 2}`), EIDs: []openrtb2.EID{ @@ -4619,7 +4619,7 @@ func TestCleanOpenRTBRequestsActivities(t *testing.T) { DPIDSHA1: "DPIDSHA1", MACMD5: "MACMD5", MACSHA1: "MACSHA1", - Geo: &openrtb2.Geo{Lat: 123.46, Lon: 11.28}, + Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.46), Lon: ptrutil.ToPtr(11.28)}, }, expectedSource: expectedSourceDefault, }, diff --git a/firstpartydata/first_party_data.go b/firstpartydata/first_party_data.go index 8e482ce700b..8c77f61a3d6 100644 --- a/firstpartydata/first_party_data.go +++ b/firstpartydata/first_party_data.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" jsonpatch "gopkg.in/evanphx/json-patch.v4" "github.com/prebid/prebid-server/v2/errortypes" diff --git a/firstpartydata/first_party_data_test.go b/firstpartydata/first_party_data_test.go index aa00c981fa7..f417a24d7e7 100644 --- a/firstpartydata/first_party_data_test.go +++ b/firstpartydata/first_party_data_test.go @@ -7,10 +7,11 @@ import ( "reflect" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/jsonutil" + "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -1248,9 +1249,9 @@ func TestMergeUser(t *testing.T) { }, { name: "nested-geo", - givenUser: openrtb2.User{Geo: &openrtb2.Geo{Lat: 1}}, + givenUser: openrtb2.User{Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(1.0)}}, givenFPD: []byte(`{"geo":{"lat": 2}}`), - expectedUser: openrtb2.User{Geo: &openrtb2.Geo{Lat: 2}}, + expectedUser: openrtb2.User{Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(2.0)}}, }, { name: "nested-geo-ext", @@ -1886,20 +1887,6 @@ var ( } } } -`) - - user = []byte(` -{ - "id": "2", - "yob": 2000, - "geo": { - "city": "LA", - "ext": { - "b": 100, - "c": 3 - } - } -} `) ) diff --git a/floors/enforce.go b/floors/enforce.go index e1f4d8d015b..d499c7d3806 100644 --- a/floors/enforce.go +++ b/floors/enforce.go @@ -5,7 +5,7 @@ import ( "fmt" "math/rand" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/currency" "github.com/prebid/prebid-server/v2/exchange/entities" diff --git a/floors/enforce_test.go b/floors/enforce_test.go index 085506c3411..9b3fd36a717 100644 --- a/floors/enforce_test.go +++ b/floors/enforce_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/currency" "github.com/prebid/prebid-server/v2/exchange/entities" @@ -765,7 +765,7 @@ func TestUpdateBidExtWithFloors(t *testing.T) { { name: "Valid prebid extension in imp.ext", args: args{ - reqImp: &openrtb_ext.ImpWrapper{Imp: &openrtb2.Imp{ID: "1234", Video: &openrtb2.Video{W: 300, H: 250}, Ext: []byte(`{"prebid":{"floors":{"floorrule":"test|123|xyz","floorrulevalue":5.5,"floorvalue":5.5}}}`)}}, + reqImp: &openrtb_ext.ImpWrapper{Imp: &openrtb2.Imp{ID: "1234", Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](300), H: ptrutil.ToPtr[int64](250)}, Ext: []byte(`{"prebid":{"floors":{"floorrule":"test|123|xyz","floorrulevalue":5.5,"floorvalue":5.5}}}`)}}, bid: &entities.PbsOrtbBid{ Bid: &openrtb2.Bid{ Price: 10.10, diff --git a/floors/floors_test.go b/floors/floors_test.go index 9e2f411c1c6..f5f71df4685 100644 --- a/floors/floors_test.go +++ b/floors/floors_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/currency" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/floors/rule.go b/floors/rule.go index 50c12462d28..ec696dd0f76 100644 --- a/floors/rule.go +++ b/floors/rule.go @@ -8,9 +8,10 @@ import ( "strings" "github.com/golang/glog" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/currency" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" ) const ( @@ -291,8 +292,8 @@ func getSizeValue(imp *openrtb2.Imp) string { if imp.Banner != nil { width, height = getBannerSize(imp) } else if imp.Video != nil { - width = imp.Video.W - height = imp.Video.H + width = ptrutil.ValueOrDefault(imp.Video.W) + height = ptrutil.ValueOrDefault(imp.Video.H) } if width != 0 && height != 0 { diff --git a/floors/rule_test.go b/floors/rule_test.go index 1e75956243d..b01bab79384 100644 --- a/floors/rule_test.go +++ b/floors/rule_test.go @@ -5,9 +5,10 @@ import ( "errors" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/currency" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/stretchr/testify/assert" ) @@ -195,7 +196,7 @@ func TestUpdateImpExtWithFloorDetails(t *testing.T) { matchedRule: "test|123|xyz", floorRuleVal: 5.5, floorVal: 5.5, - imp: &openrtb_ext.ImpWrapper{Imp: &openrtb2.Imp{ID: "1234", Video: &openrtb2.Video{W: 300, H: 250}}}, + imp: &openrtb_ext.ImpWrapper{Imp: &openrtb2.Imp{ID: "1234", Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](300), H: ptrutil.ToPtr[int64](250)}}}, expected: []byte(`{"prebid":{"floors":{"floorrule":"test|123|xyz","floorrulevalue":5.5,"floorvalue":5.5}}}`), }, { @@ -203,7 +204,7 @@ func TestUpdateImpExtWithFloorDetails(t *testing.T) { matchedRule: "test|123|xyz", floorRuleVal: 5.5, floorVal: 5.5, - imp: &openrtb_ext.ImpWrapper{Imp: &openrtb2.Imp{ID: "1234", Video: &openrtb2.Video{W: 300, H: 250}, Ext: json.RawMessage{}}}, + imp: &openrtb_ext.ImpWrapper{Imp: &openrtb2.Imp{ID: "1234", Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](300), H: ptrutil.ToPtr[int64](250)}, Ext: json.RawMessage{}}}, expected: []byte(`{"prebid":{"floors":{"floorrule":"test|123|xyz","floorrulevalue":5.5,"floorvalue":5.5}}}`), }, { @@ -211,7 +212,7 @@ func TestUpdateImpExtWithFloorDetails(t *testing.T) { matchedRule: "banner|www.test.com|*", floorRuleVal: 5.5, floorVal: 15.5, - imp: &openrtb_ext.ImpWrapper{Imp: &openrtb2.Imp{ID: "1234", Video: &openrtb2.Video{W: 300, H: 250}, Ext: []byte(`{"prebid": {"test": true}}`)}}, + imp: &openrtb_ext.ImpWrapper{Imp: &openrtb2.Imp{ID: "1234", Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](300), H: ptrutil.ToPtr[int64](250)}, Ext: []byte(`{"prebid": {"test": true}}`)}}, expected: []byte(`{"prebid":{"floors":{"floorrule":"banner|www.test.com|*","floorrulevalue":5.5,"floorvalue":15.5}}}`), }, } @@ -251,7 +252,7 @@ func TestCreateRuleKeys(t *testing.T) { Site: &openrtb2.Site{ Domain: "www.test.com", }, - Imp: []openrtb2.Imp{{ID: "1234", Video: &openrtb2.Video{W: 640, H: 480, Placement: 1}}}, + Imp: []openrtb2.Imp{{ID: "1234", Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](640), H: ptrutil.ToPtr[int64](480), Placement: 1}}}, }, floorSchema: openrtb_ext.PriceFloorSchema{Delimiter: "|", Fields: []string{"mediaType", "size", "domain"}}, out: []string{"video", "640x480", "www.test.com"}, @@ -262,7 +263,7 @@ func TestCreateRuleKeys(t *testing.T) { Site: &openrtb2.Site{ Domain: "www.test.com", }, - Imp: []openrtb2.Imp{{ID: "1234", Video: &openrtb2.Video{W: 300, H: 250, Placement: 2}}}, + Imp: []openrtb2.Imp{{ID: "1234", Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](300), H: ptrutil.ToPtr[int64](250), Placement: 2}}}, }, floorSchema: openrtb_ext.PriceFloorSchema{Delimiter: "|", Fields: []string{"mediaType", "size", "domain"}}, out: []string{"video-outstream", "300x250", "www.test.com"}, @@ -1015,7 +1016,7 @@ func TestGetSizeValue(t *testing.T) { }, { name: "video: imp.video.w and imp.video.h present", - imp: &openrtb2.Imp{Video: &openrtb2.Video{W: 120, H: 240}}, + imp: &openrtb2.Imp{Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](120), H: ptrutil.ToPtr[int64](240)}}, want: "120x240", }, { @@ -1045,7 +1046,7 @@ func TestGetMediaType(t *testing.T) { }{ { name: "more than one of these: imp.banner, imp.video, imp.native, imp.audio present", - imp: &openrtb2.Imp{Video: &openrtb2.Video{W: 120, H: 240}, Banner: &openrtb2.Banner{W: getInt64Ptr(320), H: getInt64Ptr(240)}}, + imp: &openrtb2.Imp{Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](120), H: ptrutil.ToPtr[int64](240)}, Banner: &openrtb2.Banner{W: getInt64Ptr(320), H: getInt64Ptr(240)}}, want: "*", }, { @@ -1055,12 +1056,12 @@ func TestGetMediaType(t *testing.T) { }, { name: "video-outstream present", - imp: &openrtb2.Imp{Video: &openrtb2.Video{W: 120, H: 240, Placement: 2}}, + imp: &openrtb2.Imp{Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](120), H: ptrutil.ToPtr[int64](240), Placement: 2}}, want: "video-outstream", }, { name: "video-instream present", - imp: &openrtb2.Imp{Video: &openrtb2.Video{W: 120, H: 240, Placement: 1}}, + imp: &openrtb2.Imp{Video: &openrtb2.Video{W: ptrutil.ToPtr[int64](120), H: ptrutil.ToPtr[int64](240), Placement: 1}}, want: "video", }, { diff --git a/go.mod b/go.mod index 9a55cddb00a..708a24d9955 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/prebid/go-gdpr v1.12.0 github.com/prebid/go-gpp v0.1.1 - github.com/prebid/openrtb/v19 v19.0.0 + github.com/prebid/openrtb/v20 v20.1.0 github.com/prometheus/client_golang v1.12.1 github.com/prometheus/client_model v0.2.0 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 diff --git a/go.sum b/go.sum index ad2d5ba94b8..066ea784615 100644 --- a/go.sum +++ b/go.sum @@ -402,8 +402,8 @@ github.com/prebid/go-gdpr v1.12.0 h1:OrjQ7Uc+lCRYaOirQ48jjG/PBMvZsKNAaRTgzxN6iZ0 github.com/prebid/go-gdpr v1.12.0/go.mod h1:mPZAdkRxn+iuSjaUuJAi9+0SppBOdM1PCzv/55UH3pY= github.com/prebid/go-gpp v0.1.1 h1:uTMJ+eHmKWL9WvDuxFT4LDoOeJW1yOsfWITqi49ZuY0= github.com/prebid/go-gpp v0.1.1/go.mod h1:b0TLoVln+HXFD9L9xeimxIH3FN8WDKPJ42auslxEkow= -github.com/prebid/openrtb/v19 v19.0.0 h1:NA7okrg7KcvL5wEg6yI0mAyujpyfkC8XSQr3h5ocN88= -github.com/prebid/openrtb/v19 v19.0.0/go.mod h1:jK+/g4Dh5vOnNl0Nh7isbZlub29aJYyrtoBkjmhzTIg= +github.com/prebid/openrtb/v20 v20.1.0 h1:Rb+Z3H3UxiqqnjgJK3R9Wt73ibrh7HPzG7ikBckQNqc= +github.com/prebid/openrtb/v20 v20.1.0/go.mod h1:hLBrA/APkSrxs5MaW639l+y/EAHivDfRagO2TX/wbSc= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= diff --git a/hooks/hookexecution/enricher.go b/hooks/hookexecution/enricher.go index ff7f8dd562e..3617a528660 100644 --- a/hooks/hookexecution/enricher.go +++ b/hooks/hookexecution/enricher.go @@ -4,7 +4,7 @@ import ( "encoding/json" "github.com/buger/jsonparser" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/util/jsonutil" jsonpatch "gopkg.in/evanphx/json-patch.v4" diff --git a/hooks/hookexecution/enricher_test.go b/hooks/hookexecution/enricher_test.go index e0732dfe13b..4f962dea279 100644 --- a/hooks/hookexecution/enricher_test.go +++ b/hooks/hookexecution/enricher_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/hooks/hookanalytics" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/hooks/hookexecution/execution.go b/hooks/hookexecution/execution.go index ac9e9c2c802..03500bb5f0e 100644 --- a/hooks/hookexecution/execution.go +++ b/hooks/hookexecution/execution.go @@ -3,17 +3,18 @@ package hookexecution import ( "context" "fmt" - "github.com/prebid/prebid-server/v2/config" - "github.com/prebid/prebid-server/v2/ortb" - "github.com/prebid/prebid-server/v2/util/iputil" "strings" "sync" "time" + "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/hooks" "github.com/prebid/prebid-server/v2/hooks/hookstage" "github.com/prebid/prebid-server/v2/metrics" + "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/ortb" "github.com/prebid/prebid-server/v2/privacy" + "github.com/prebid/prebid-server/v2/util/iputil" ) type hookResponse[T any] struct { @@ -334,7 +335,9 @@ func handleModuleActivities[P any](hookCode string, activityControl privacy.Acti // changes need to be applied to new payload and leave original payload unchanged bidderReq := payloadData.GetBidderRequestPayload() - bidderReqCopy := ortb.CloneBidderReq(bidderReq.BidRequest) + bidderReqCopy := &openrtb_ext.RequestWrapper{ + BidRequest: ortb.CloneBidRequestPartial(bidderReq.BidRequest), + } if !transmitUserFPDActivityAllowed { privacy.ScrubUserFPD(bidderReqCopy) diff --git a/hooks/hookexecution/execution_test.go b/hooks/hookexecution/execution_test.go index 0986742e506..c7d17a15e9f 100644 --- a/hooks/hookexecution/execution_test.go +++ b/hooks/hookexecution/execution_test.go @@ -1,13 +1,14 @@ package hookexecution import ( - "github.com/prebid/openrtb/v19/openrtb2" + "testing" + + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/hooks/hookstage" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/privacy" "github.com/stretchr/testify/assert" - "testing" ) const ( diff --git a/hooks/hookexecution/executor.go b/hooks/hookexecution/executor.go index 518a0c628a6..cc3ada786d0 100644 --- a/hooks/hookexecution/executor.go +++ b/hooks/hookexecution/executor.go @@ -5,7 +5,7 @@ import ( "net/http" "sync" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/exchange/entities" diff --git a/hooks/hookexecution/executor_test.go b/hooks/hookexecution/executor_test.go index a427949a9ab..2f7cb077494 100644 --- a/hooks/hookexecution/executor_test.go +++ b/hooks/hookexecution/executor_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/exchange/entities" diff --git a/hooks/hookstage/auctionresponse.go b/hooks/hookstage/auctionresponse.go index d47c78de5e1..c0810b196c1 100644 --- a/hooks/hookstage/auctionresponse.go +++ b/hooks/hookstage/auctionresponse.go @@ -3,7 +3,7 @@ package hookstage import ( "context" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) // AuctionResponse hooks are invoked at the very end of request processing. diff --git a/hooks/hookstage/bidderrequest_mutations.go b/hooks/hookstage/bidderrequest_mutations.go index 746878cb4a1..6f4d5a5bacb 100644 --- a/hooks/hookstage/bidderrequest_mutations.go +++ b/hooks/hookstage/bidderrequest_mutations.go @@ -2,9 +2,10 @@ package hookstage import ( "errors" + "github.com/prebid/prebid-server/v2/openrtb_ext" - "github.com/prebid/openrtb/v19/adcom1" + "github.com/prebid/openrtb/v20/adcom1" ) func (c *ChangeSet[T]) BidderRequest() ChangeSetBidderRequest[T] { diff --git a/macros/provider_test.go b/macros/provider_test.go index ee9663e3269..b3f5c9a88a9 100644 --- a/macros/provider_test.go +++ b/macros/provider_test.go @@ -3,7 +3,7 @@ package macros import ( "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/exchange/entities" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" diff --git a/macros/string_index_based_replacer_test.go b/macros/string_index_based_replacer_test.go index c9a05a83df4..eb81a1520e9 100644 --- a/macros/string_index_based_replacer_test.go +++ b/macros/string_index_based_replacer_test.go @@ -3,7 +3,7 @@ package macros import ( "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/exchange/entities" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" diff --git a/modules/prebid/ortb2blocking/config.go b/modules/prebid/ortb2blocking/config.go index 4b832cb1977..634170ef192 100644 --- a/modules/prebid/ortb2blocking/config.go +++ b/modules/prebid/ortb2blocking/config.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/prebid/openrtb/v19/adcom1" + "github.com/prebid/openrtb/v20/adcom1" "github.com/prebid/prebid-server/v2/util/jsonutil" ) diff --git a/modules/prebid/ortb2blocking/config_test.go b/modules/prebid/ortb2blocking/config_test.go index 55ca3d21807..067e0786930 100644 --- a/modules/prebid/ortb2blocking/config_test.go +++ b/modules/prebid/ortb2blocking/config_test.go @@ -3,7 +3,7 @@ package ortb2blocking import ( "testing" - "github.com/prebid/openrtb/v19/adcom1" + "github.com/prebid/openrtb/v20/adcom1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/modules/prebid/ortb2blocking/hook_bidderrequest.go b/modules/prebid/ortb2blocking/hook_bidderrequest.go index 602e75aec95..02e3634f679 100644 --- a/modules/prebid/ortb2blocking/hook_bidderrequest.go +++ b/modules/prebid/ortb2blocking/hook_bidderrequest.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/hooks/hookexecution" "github.com/prebid/prebid-server/v2/hooks/hookstage" "github.com/prebid/prebid-server/v2/openrtb_ext" diff --git a/modules/prebid/ortb2blocking/hook_raw_bidder_response.go b/modules/prebid/ortb2blocking/hook_raw_bidder_response.go index 615ceda9e04..215de260b09 100644 --- a/modules/prebid/ortb2blocking/hook_raw_bidder_response.go +++ b/modules/prebid/ortb2blocking/hook_raw_bidder_response.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/hooks/hookexecution" "github.com/prebid/prebid-server/v2/hooks/hookstage" diff --git a/modules/prebid/ortb2blocking/module.go b/modules/prebid/ortb2blocking/module.go index 93ca15ff31e..0b85c43dad2 100644 --- a/modules/prebid/ortb2blocking/module.go +++ b/modules/prebid/ortb2blocking/module.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" - "github.com/prebid/openrtb/v19/adcom1" + "github.com/prebid/openrtb/v20/adcom1" "github.com/prebid/prebid-server/v2/hooks/hookstage" "github.com/prebid/prebid-server/v2/modules/moduledeps" ) diff --git a/modules/prebid/ortb2blocking/module_test.go b/modules/prebid/ortb2blocking/module_test.go index fc5cdcc7af6..8178cba15fe 100644 --- a/modules/prebid/ortb2blocking/module_test.go +++ b/modules/prebid/ortb2blocking/module_test.go @@ -6,8 +6,8 @@ import ( "errors" "testing" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/hooks/hookanalytics" "github.com/prebid/prebid-server/v2/hooks/hookexecution" diff --git a/modules/prebid/ortb2blocking/utils.go b/modules/prebid/ortb2blocking/utils.go index 701658dc6cc..a6b9c02c708 100644 --- a/modules/prebid/ortb2blocking/utils.go +++ b/modules/prebid/ortb2blocking/utils.go @@ -3,8 +3,8 @@ package ortb2blocking import ( "strings" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" ) func mergeStrings(messages []string, newMessages ...string) []string { diff --git a/openrtb_ext/bid_request_video.go b/openrtb_ext/bid_request_video.go index d9505fb6257..fbaf1dbb54c 100644 --- a/openrtb_ext/bid_request_video.go +++ b/openrtb_ext/bid_request_video.go @@ -1,6 +1,6 @@ package openrtb_ext -import "github.com/prebid/openrtb/v19/openrtb2" +import "github.com/prebid/openrtb/v20/openrtb2" type BidRequestVideo struct { // Attribute: diff --git a/openrtb_ext/convert_down.go b/openrtb_ext/convert_down.go index 573ef64fdc0..e0842978551 100644 --- a/openrtb_ext/convert_down.go +++ b/openrtb_ext/convert_down.go @@ -36,6 +36,7 @@ func ConvertDownTo25(r *RequestWrapper) error { clear26Fields(r) clear202211Fields(r) clear202303Fields(r) + clear202309Fields(r) return nil } @@ -308,3 +309,27 @@ func clear202303Fields(r *RequestWrapper) { } } } + +// clear202309Fields sets all fields introduced in OpenRTB 2.6-202309 to default values +// which will cause them to be omitted during json marshal. +func clear202309Fields(r *RequestWrapper) { + r.ACat = nil + + for _, imp := range r.GetImp() { + if audio := imp.Audio; audio != nil { + audio.DurFloors = nil + } + + if video := imp.Video; video != nil { + video.DurFloors = nil + } + + if pmp := imp.PMP; pmp != nil { + for i := range pmp.Deals { + pmp.Deals[i].Guar = 0 + pmp.Deals[i].MinCPMPerSec = 0 + pmp.Deals[i].DurFloors = nil + } + } + } +} diff --git a/openrtb_ext/convert_down_test.go b/openrtb_ext/convert_down_test.go index a72ba3a48ad..1bf112dcb3a 100644 --- a/openrtb_ext/convert_down_test.go +++ b/openrtb_ext/convert_down_test.go @@ -4,9 +4,10 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/errortypes" + "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/stretchr/testify/assert" ) @@ -61,13 +62,23 @@ func TestConvertDownTo25(t *testing.T) { name: "2.6-202303-dropped", // integration with clear202303Fields givenRequest: openrtb2.BidRequest{ ID: "anyID", - Imp: []openrtb2.Imp{{ID: "1", Refresh: &openrtb2.Refresh{Count: 1}}}, + Imp: []openrtb2.Imp{{ID: "1", Refresh: &openrtb2.Refresh{Count: ptrutil.ToPtr(1)}}}, }, expectedRequest: openrtb2.BidRequest{ ID: "anyID", Imp: []openrtb2.Imp{{ID: "1"}}, }, }, + { + name: "2.6-202309-dropped", // integration with clear202309Fields + givenRequest: openrtb2.BidRequest{ + ID: "anyID", + ACat: []string{"anyACat"}, + }, + expectedRequest: openrtb2.BidRequest{ + ID: "anyID", + }, + }, { name: "2.6-to-2.5-OtherExtFields", givenRequest: openrtb2.BidRequest{ @@ -683,7 +694,7 @@ func TestClear202303Fields(t *testing.T) { { ID: "imp1", Video: &openrtb2.Video{PodID: "1", Plcmt: adcom1.VideoPlcmtInstream}, - Refresh: &openrtb2.Refresh{Count: 1}, + Refresh: &openrtb2.Refresh{Count: ptrutil.ToPtr(1)}, }, }, } @@ -702,3 +713,50 @@ func TestClear202303Fields(t *testing.T) { clear202303Fields(r) assert.Equal(t, expected, given) } + +func TestClear202309Fields(t *testing.T) { + givenDurFloors := []openrtb2.DurFloors{{MinDur: 15, MaxDur: 30, BidFloor: 100}} + + given := openrtb2.BidRequest{ + ID: "anyID", + ACat: []string{"acat1", "acat2"}, + Imp: []openrtb2.Imp{ + { + ID: "imp1", + Audio: &openrtb2.Audio{PodID: "1", DurFloors: givenDurFloors}, + }, + { + ID: "imp2", + Video: &openrtb2.Video{PodID: "2", DurFloors: givenDurFloors}, + PMP: &openrtb2.PMP{ + PrivateAuction: 1, + Deals: []openrtb2.Deal{ + {ID: "deal1", BidFloor: 200, Guar: 1, MinCPMPerSec: 2, DurFloors: givenDurFloors}}, + }, + }, + }, + } + + expected := openrtb2.BidRequest{ + ID: "anyID", + Imp: []openrtb2.Imp{ + { + ID: "imp1", + Audio: &openrtb2.Audio{PodID: "1"}, + }, + { + ID: "imp2", + Video: &openrtb2.Video{PodID: "2"}, + PMP: &openrtb2.PMP{ + PrivateAuction: 1, + Deals: []openrtb2.Deal{ + {ID: "deal1", BidFloor: 200}}, + }, + }, + }, + } + + r := &RequestWrapper{BidRequest: &given} + clear202309Fields(r) + assert.Equal(t, expected, given) +} diff --git a/openrtb_ext/convert_up.go b/openrtb_ext/convert_up.go index e8116cad11c..2cfb07fb071 100644 --- a/openrtb_ext/convert_up.go +++ b/openrtb_ext/convert_up.go @@ -3,7 +3,7 @@ package openrtb_ext import ( "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) func ConvertUpTo26(r *RequestWrapper) error { diff --git a/openrtb_ext/convert_up_test.go b/openrtb_ext/convert_up_test.go index 3cafe8c1612..f83b85be897 100644 --- a/openrtb_ext/convert_up_test.go +++ b/openrtb_ext/convert_up_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/openrtb_ext/deal_tier.go b/openrtb_ext/deal_tier.go index b268e7755fc..e96ca4b8473 100644 --- a/openrtb_ext/deal_tier.go +++ b/openrtb_ext/deal_tier.go @@ -1,7 +1,7 @@ package openrtb_ext import ( - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/util/jsonutil" ) diff --git a/openrtb_ext/deal_tier_test.go b/openrtb_ext/deal_tier_test.go index 4a9ed2c8ec9..5407dd2af38 100644 --- a/openrtb_ext/deal_tier_test.go +++ b/openrtb_ext/deal_tier_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/errortypes" "github.com/stretchr/testify/assert" ) diff --git a/openrtb_ext/request.go b/openrtb_ext/request.go index 1a98e34d13f..90a95a1b16e 100644 --- a/openrtb_ext/request.go +++ b/openrtb_ext/request.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/util/jsonutil" "github.com/prebid/prebid-server/v2/util/maputil" "github.com/prebid/prebid-server/v2/util/ptrutil" diff --git a/openrtb_ext/request_test.go b/openrtb_ext/request_test.go index 3163150e57c..81a12965307 100644 --- a/openrtb_ext/request_test.go +++ b/openrtb_ext/request_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/util/jsonutil" "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/stretchr/testify/assert" diff --git a/openrtb_ext/request_wrapper.go b/openrtb_ext/request_wrapper.go index 5adc192d36f..d8fe02eadfa 100644 --- a/openrtb_ext/request_wrapper.go +++ b/openrtb_ext/request_wrapper.go @@ -4,7 +4,7 @@ import ( "encoding/json" "errors" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/util/jsonutil" "github.com/prebid/prebid-server/v2/util/maputil" "github.com/prebid/prebid-server/v2/util/ptrutil" diff --git a/openrtb_ext/request_wrapper_test.go b/openrtb_ext/request_wrapper_test.go index bd55c86beb2..6c318e37eb7 100644 --- a/openrtb_ext/request_wrapper_test.go +++ b/openrtb_ext/request_wrapper_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/stretchr/testify/assert" diff --git a/openrtb_ext/response.go b/openrtb_ext/response.go index 8e9f36e8484..d9baea3f4da 100644 --- a/openrtb_ext/response.go +++ b/openrtb_ext/response.go @@ -3,8 +3,8 @@ package openrtb_ext import ( "encoding/json" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" ) // ExtBidResponse defines the contract for bidresponse.ext @@ -103,9 +103,9 @@ const ( ) // NonBidObject is subset of Bid object with exact json signature -// defined at https://github.com/prebid/openrtb/blob/v19.0.0/openrtb2/bid.go // It also contains the custom fields type NonBidObject struct { + // SubSet Price float64 `json:"price,omitempty"` ADomain []string `json:"adomain,omitempty"` CatTax adcom1.CategoryTaxonomy `json:"cattax,omitempty"` @@ -116,6 +116,7 @@ type NonBidObject struct { Dur int64 `json:"dur,omitempty"` MType openrtb2.MarkupType `json:"mtype,omitempty"` + // Custom Fields OriginalBidCPM float64 `json:"origbidcpm,omitempty"` OriginalBidCur string `json:"origbidcur,omitempty"` } diff --git a/openrtb_ext/source.go b/openrtb_ext/source.go index 78112ec7668..dd2a4b0ddc8 100644 --- a/openrtb_ext/source.go +++ b/openrtb_ext/source.go @@ -1,6 +1,6 @@ package openrtb_ext -import "github.com/prebid/openrtb/v19/openrtb2" +import "github.com/prebid/openrtb/v20/openrtb2" // ExtSource defines the contract for bidrequest.source.ext type ExtSource struct { diff --git a/openrtb_ext/supplyChain.go b/openrtb_ext/supplyChain.go index 0ccbd0957fa..1dc9cc3b359 100644 --- a/openrtb_ext/supplyChain.go +++ b/openrtb_ext/supplyChain.go @@ -1,7 +1,7 @@ package openrtb_ext import ( - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/util/ptrutil" ) diff --git a/openrtb_ext/supplyChain_test.go b/openrtb_ext/supplyChain_test.go index 728fbc68cc4..0ab67e87d67 100644 --- a/openrtb_ext/supplyChain_test.go +++ b/openrtb_ext/supplyChain_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/stretchr/testify/assert" ) diff --git a/openrtb_ext/user.go b/openrtb_ext/user.go index 19c6bbc9a6c..422c3f85e7b 100644 --- a/openrtb_ext/user.go +++ b/openrtb_ext/user.go @@ -4,7 +4,7 @@ import ( "strconv" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" ) // ExtUser defines the contract for bidrequest.user.ext diff --git a/ortb/clone.go b/ortb/clone.go index 2fe9be68f74..3023169bc8c 100644 --- a/ortb/clone.go +++ b/ortb/clone.go @@ -1,8 +1,7 @@ package ortb import ( - "github.com/prebid/openrtb/v19/openrtb2" - "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/prebid/prebid-server/v2/util/sliceutil" ) @@ -19,6 +18,8 @@ func CloneApp(s *openrtb2.App) *openrtb2.App { c.Cat = sliceutil.Clone(s.Cat) c.SectionCat = sliceutil.Clone(s.SectionCat) c.PageCat = sliceutil.Clone(s.PageCat) + c.PrivacyPolicy = ptrutil.Clone(s.PrivacyPolicy) + c.Paid = ptrutil.Clone(s.Paid) c.Publisher = ClonePublisher(s.Publisher) c.Content = CloneContent(s.Content) c.KwArray = sliceutil.Clone(s.KwArray) @@ -56,6 +57,9 @@ func CloneContent(s *openrtb2.Content) *openrtb2.Content { c.ProdQ = ptrutil.Clone(s.ProdQ) c.VideoQuality = ptrutil.Clone(s.VideoQuality) c.KwArray = sliceutil.Clone(s.KwArray) + c.LiveStream = ptrutil.Clone(s.LiveStream) + c.SourceRelationship = ptrutil.Clone(s.SourceRelationship) + c.Embeddable = ptrutil.Clone(s.Embeddable) c.Data = CloneDataSlice(s.Data) c.Network = CloneNetwork(s.Network) c.Channel = CloneChannel(s.Channel) @@ -94,6 +98,7 @@ func CloneDataSlice(s []openrtb2.Data) []openrtb2.Data { func CloneData(s openrtb2.Data) openrtb2.Data { // Shallow Copy (Value Fields) Occurred By Passing Argument By Value + // - Implicitly created by the cloned array. // Deep Copy (Pointers) s.Segment = CloneSegmentSlice(s.Segment) @@ -117,6 +122,7 @@ func CloneSegmentSlice(s []openrtb2.Segment) []openrtb2.Segment { func CloneSegment(s openrtb2.Segment) openrtb2.Segment { // Shallow Copy (Value Fields) Occurred By Passing Argument By Value + // - Implicitly created by the cloned array. // Deep Copy (Pointers) s.Ext = sliceutil.Clone(s.Ext) @@ -164,6 +170,8 @@ func CloneSite(s *openrtb2.Site) *openrtb2.Site { c.Cat = sliceutil.Clone(s.Cat) c.SectionCat = sliceutil.Clone(s.SectionCat) c.PageCat = sliceutil.Clone(s.PageCat) + c.Mobile = ptrutil.Clone(s.Mobile) + c.PrivacyPolicy = ptrutil.Clone(s.PrivacyPolicy) c.Publisher = ClonePublisher(s.Publisher) c.Content = CloneContent(s.Content) c.KwArray = sliceutil.Clone(s.KwArray) @@ -200,30 +208,17 @@ func CloneDevice(s *openrtb2.Device) *openrtb2.Device { // Deep Copy (Pointers) c.Geo = CloneGeo(s.Geo) - - c.DNT = CloneInt8Pointer(s.DNT) - c.Lmt = CloneInt8Pointer(s.Lmt) - + c.DNT = ptrutil.Clone(s.DNT) + c.Lmt = ptrutil.Clone(s.Lmt) c.SUA = CloneUserAgent(s.SUA) - if s.ConnectionType != nil { - connectionTypeCopy := s.ConnectionType.Val() - c.ConnectionType = &connectionTypeCopy - } - + c.JS = ptrutil.Clone(s.JS) + c.GeoFetch = ptrutil.Clone(s.GeoFetch) + c.ConnectionType = ptrutil.Clone(s.ConnectionType) c.Ext = sliceutil.Clone(s.Ext) return &c } -func CloneInt8Pointer(s *int8) *int8 { - if s == nil { - return nil - } - var dntCopy int8 - dntCopy = *s - return &dntCopy -} - func CloneUserAgent(s *openrtb2.UserAgent) *openrtb2.UserAgent { if s == nil { return nil @@ -263,6 +258,8 @@ func CloneBrandVersion(s *openrtb2.BrandVersion) *openrtb2.BrandVersion { if s == nil { return nil } + + // Shallow Copy (Value Fields) Occurred By Passing Argument By Value c := *s // Deep Copy (Pointers) @@ -281,6 +278,7 @@ func CloneSource(s *openrtb2.Source) *openrtb2.Source { c := *s // Deep Copy (Pointers) + c.FD = ptrutil.Clone(s.FD) c.SChain = CloneSChain(s.SChain) c.Ext = sliceutil.Clone(s.Ext) @@ -291,6 +289,7 @@ func CloneSChain(s *openrtb2.SupplyChain) *openrtb2.SupplyChain { if s == nil { return nil } + // Shallow Copy (Value Fields) c := *s @@ -316,9 +315,10 @@ func CloneSupplyChainNodes(s []openrtb2.SupplyChainNode) []openrtb2.SupplyChainN func CloneSupplyChainNode(s openrtb2.SupplyChainNode) openrtb2.SupplyChainNode { // Shallow Copy (Value Fields) Occurred By Passing Argument By Value + // - Implicitly created by the cloned array. // Deep Copy (Pointers) - s.HP = CloneInt8Pointer(s.HP) + s.HP = ptrutil.Clone(s.HP) s.Ext = sliceutil.Clone(s.Ext) return s @@ -333,6 +333,8 @@ func CloneGeo(s *openrtb2.Geo) *openrtb2.Geo { c := *s // Deep Copy (Pointers) + c.Lat = ptrutil.Clone(s.Lat) + c.Lon = ptrutil.Clone(s.Lon) c.Ext = sliceutil.Clone(s.Ext) return &c @@ -353,6 +355,7 @@ func CloneEIDSlice(s []openrtb2.EID) []openrtb2.EID { func CloneEID(s openrtb2.EID) openrtb2.EID { // Shallow Copy (Value Fields) Occurred By Passing Argument By Value + // - Implicitly created by the cloned array. // Deep Copy (Pointers) s.UIDs = CloneUIDSlice(s.UIDs) @@ -376,6 +379,7 @@ func CloneUIDSlice(s []openrtb2.UID) []openrtb2.UID { func CloneUID(s openrtb2.UID) openrtb2.UID { // Shallow Copy (Value Fields) Occurred By Passing Argument By Value + // - Implicitly created by the cloned array. // Deep Copy (Pointers) s.Ext = sliceutil.Clone(s.Ext) @@ -401,32 +405,19 @@ func CloneDOOH(s *openrtb2.DOOH) *openrtb2.DOOH { return &c } -// cloneBidderReq - clones bidder request and replaces req.User and req.Device and req.Source with new copies -func CloneBidderReq(req *openrtb2.BidRequest) *openrtb_ext.RequestWrapper { - if req == nil { +// CloneBidRequestPartial performs a deep clone of just the bid request device, user, and source fields. +func CloneBidRequestPartial(s *openrtb2.BidRequest) *openrtb2.BidRequest { + if s == nil { return nil } - // bidder request may be modified differently per bidder based on privacy configs - // new request should be created for each bidder request - // pointer fields like User and Device should be cloned and set back to the request copy - newReq := ptrutil.Clone(req) - - if req.User != nil { - userCopy := CloneUser(req.User) - newReq.User = userCopy - } - - if req.Device != nil { - deviceCopy := CloneDevice(req.Device) - newReq.Device = deviceCopy - } + // Shallow Copy (Value Fields) + c := *s - if req.Source != nil { - sourceCopy := CloneSource(req.Source) - newReq.Source = sourceCopy - } + // Deep Copy (Pointers) - PARTIAL CLONE + c.Device = CloneDevice(s.Device) + c.User = CloneUser(s.User) + c.Source = CloneSource(s.Source) - reqWrapper := &openrtb_ext.RequestWrapper{BidRequest: newReq} - return reqWrapper + return &c } diff --git a/ortb/clone_test.go b/ortb/clone_test.go index 1afc269240b..73d03614db4 100644 --- a/ortb/clone_test.go +++ b/ortb/clone_test.go @@ -5,8 +5,8 @@ import ( "reflect" "testing" - "github.com/prebid/openrtb/v19/adcom1" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/adcom1" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/stretchr/testify/assert" ) @@ -36,8 +36,8 @@ func TestCloneApp(t *testing.T) { SectionCat: []string{"sectionCat1"}, PageCat: []string{"pageCat1"}, Ver: "anyVer", - PrivacyPolicy: 1, - Paid: 2, + PrivacyPolicy: ptrutil.ToPtr[int8](1), + Paid: ptrutil.ToPtr[int8](2), Publisher: &openrtb2.Publisher{ID: "anyPublisher", Ext: json.RawMessage(`{"publisher":1}`)}, Content: &openrtb2.Content{ID: "anyContent", Ext: json.RawMessage(`{"content":1}`)}, Keywords: "anyKeywords", @@ -51,6 +51,8 @@ func TestCloneApp(t *testing.T) { assert.NotSame(t, given.Cat, result.Cat, "cat") assert.NotSame(t, given.SectionCat, result.SectionCat, "sectioncat") assert.NotSame(t, given.PageCat, result.PageCat, "pagecat") + assert.NotSame(t, given.PrivacyPolicy, result.PrivacyPolicy, "privacypolicy") + assert.NotSame(t, given.Paid, result.Paid, "paid") assert.NotSame(t, given.Publisher, result.Publisher, "publisher") assert.NotSame(t, given.Publisher.Ext, result.Publisher.Ext, "publisher-ext") assert.NotSame(t, given.Content, result.Content, "content") @@ -65,6 +67,8 @@ func TestCloneApp(t *testing.T) { "Cat", "SectionCat", "PageCat", + "PrivacyPolicy", + "Paid", "Publisher", "Content", "KwArray", @@ -147,12 +151,12 @@ func TestCloneContent(t *testing.T) { QAGMediaRating: adcom1.MediaRatingAll, Keywords: "anyKeywords", KwArray: []string{"key1"}, - LiveStream: 2, - SourceRelationship: 3, + LiveStream: ptrutil.ToPtr[int8](2), + SourceRelationship: ptrutil.ToPtr[int8](3), Len: 4, Language: "anyLanguage", LangB: "anyLangB", - Embeddable: 5, + Embeddable: ptrutil.ToPtr[int8](5), Data: []openrtb2.Data{{ID: "1", Ext: json.RawMessage(`{"data":1}`)}}, Network: &openrtb2.Network{ID: "anyNetwork", Ext: json.RawMessage(`{"network":1}`)}, Channel: &openrtb2.Channel{ID: "anyChannel", Ext: json.RawMessage(`{"channel":1}`)}, @@ -167,6 +171,9 @@ func TestCloneContent(t *testing.T) { assert.NotSame(t, given.ProdQ, result.ProdQ, "prodq") assert.NotSame(t, given.VideoQuality, result.VideoQuality, "videoquality") assert.NotSame(t, given.KwArray, result.KwArray, "kwarray") + assert.NotSame(t, given.LiveStream, result.LiveStream, "livestream") + assert.NotSame(t, given.SourceRelationship, result.SourceRelationship, "sourcerelationship") + assert.NotSame(t, given.Embeddable, result.Embeddable, "embeddable") assert.NotSame(t, given.Data, result.Data, "data") assert.NotSame(t, given.Data[0], result.Data[0], "data-item") assert.NotSame(t, given.Data[0].Ext, result.Data[0].Ext, "data-item-ext") @@ -185,6 +192,9 @@ func TestCloneContent(t *testing.T) { "ProdQ", "VideoQuality", "KwArray", + "LiveStream", + "SourceRelationship", + "Embeddable", "Data", "Network", "Channel", @@ -446,8 +456,8 @@ func TestCloneSite(t *testing.T) { Page: "anyPage", Ref: "anyRef", Search: "anySearch", - Mobile: 1, - PrivacyPolicy: 2, + Mobile: ptrutil.ToPtr[int8](1), + PrivacyPolicy: ptrutil.ToPtr[int8](2), Publisher: &openrtb2.Publisher{ID: "anyPublisher", Ext: json.RawMessage(`{"publisher":1}`)}, Content: &openrtb2.Content{ID: "anyContent", Ext: json.RawMessage(`{"content":1}`)}, Keywords: "anyKeywords", @@ -461,6 +471,8 @@ func TestCloneSite(t *testing.T) { assert.NotSame(t, given.Cat, result.Cat, "cat") assert.NotSame(t, given.SectionCat, result.SectionCat, "sectioncat") assert.NotSame(t, given.PageCat, result.PageCat, "pagecat") + assert.NotSame(t, given.Mobile, result.Mobile, "mobile") + assert.NotSame(t, given.PrivacyPolicy, result.PrivacyPolicy, "privacypolicy") assert.NotSame(t, given.Publisher, result.Publisher, "publisher") assert.NotSame(t, given.Publisher.Ext, result.Publisher.Ext, "publisher-ext") assert.NotSame(t, given.Content, result.Content, "content") @@ -475,6 +487,8 @@ func TestCloneSite(t *testing.T) { "Cat", "SectionCat", "PageCat", + "Mobile", + "PrivacyPolicy", "Publisher", "Content", "KwArray", @@ -505,7 +519,7 @@ func TestCloneUser(t *testing.T) { Keywords: "anyKeywords", KwArray: []string{"key1"}, CustomData: "anyCustomData", - Geo: &openrtb2.Geo{Lat: 1.2, Lon: 2.3, Ext: json.RawMessage(`{"geo":1}`)}, + Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(1.2), Lon: ptrutil.ToPtr(2.3), Ext: json.RawMessage(`{"geo":1}`)}, Data: []openrtb2.Data{{ID: "1", Ext: json.RawMessage(`{"data":1}`)}}, Consent: "anyConsent", EIDs: []openrtb2.EID{{Source: "1", Ext: json.RawMessage(`{"eid":1}`)}}, @@ -555,7 +569,7 @@ func TestCloneDevice(t *testing.T) { ct := adcom1.ConnectionWIFI given := &openrtb2.Device{ - Geo: &openrtb2.Geo{Lat: 1.2, Lon: 2.3, Ext: json.RawMessage(`{"geo":1}`)}, + Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(1.2), Lon: ptrutil.ToPtr(2.3), Ext: json.RawMessage(`{"geo":1}`)}, DNT: np, Lmt: np, UA: "UserAgent", @@ -572,8 +586,8 @@ func TestCloneDevice(t *testing.T) { W: 30, PPI: 100, PxRatio: 200, - JS: 2, - GeoFetch: 4, + JS: ptrutil.ToPtr[int8](2), + GeoFetch: ptrutil.ToPtr[int8](4), FlashVer: "1.22.33", Language: "En", LangB: "ENG", @@ -597,6 +611,8 @@ func TestCloneDevice(t *testing.T) { assert.NotSame(t, given.DNT, result.DNT, "dnt") assert.NotSame(t, given.Lmt, result.Lmt, "lmt") assert.NotSame(t, given.SUA, result.SUA, "sua") + assert.NotSame(t, given.JS, result.JS, "js") + assert.NotSame(t, given.GeoFetch, result.GeoFetch, "geofetch") assert.NotSame(t, given.ConnectionType, result.ConnectionType, "connectionType") assert.NotSame(t, given.Ext, result.Ext, "ext") }) @@ -608,34 +624,14 @@ func TestCloneDevice(t *testing.T) { "DNT", "Lmt", "SUA", + "JS", + "GeoFetch", "ConnectionType", "Ext", }) }) } -func TestCloneInt8Pointer(t *testing.T) { - - t.Run("nil", func(t *testing.T) { - result := CloneInt8Pointer(nil) - assert.Nil(t, result) - }) - - t.Run("empty", func(t *testing.T) { - var given *int8 - result := CloneInt8Pointer(given) - assert.Nil(t, result) - }) - - t.Run("populated", func(t *testing.T) { - var n int8 = 1 - given := &n - result := CloneInt8Pointer(given) - assert.Equal(t, given, result, "equality") - assert.NotSame(t, given, result, "pointer") - }) -} - func TestCloneUserAgent(t *testing.T) { t.Run("nil", func(t *testing.T) { result := CloneUserAgent(nil) @@ -774,7 +770,7 @@ func TestCloneSource(t *testing.T) { t.Run("populated", func(t *testing.T) { given := &openrtb2.Source{ - FD: 1, + FD: ptrutil.ToPtr[int8](1), TID: "Tid", PChain: "PChain", SChain: &openrtb2.SupplyChain{ @@ -789,6 +785,7 @@ func TestCloneSource(t *testing.T) { result := CloneSource(given) assert.Equal(t, given, result, "equality") assert.NotSame(t, given, result, "pointer") + assert.NotSame(t, given.FD, result.FD, "fd") assert.NotSame(t, given.SChain, result.SChain, "schain") assert.NotSame(t, given.SChain.Ext, result.SChain.Ext, "schain.ext") assert.NotSame(t, given.Ext, result.Ext, "ext") @@ -798,6 +795,7 @@ func TestCloneSource(t *testing.T) { t.Run("assumptions", func(t *testing.T) { assert.ElementsMatch(t, discoverPointerFields(reflect.TypeOf(openrtb2.Source{})), []string{ + "FD", "SChain", "Ext", }) @@ -929,8 +927,8 @@ func TestCloneGeo(t *testing.T) { t.Run("populated", func(t *testing.T) { given := &openrtb2.Geo{ - Lat: 1.234, - Lon: 5.678, + Lat: ptrutil.ToPtr(1.234), + Lon: ptrutil.ToPtr(5.678), Type: adcom1.LocationGPS, Accuracy: 1, LastFix: 2, @@ -947,12 +945,16 @@ func TestCloneGeo(t *testing.T) { result := CloneGeo(given) assert.Equal(t, given, result, "equality") assert.NotSame(t, given, result, "pointer") + assert.NotSame(t, given.Lat, result.Lat, "lat") + assert.NotSame(t, given.Lon, result.Lon, "lon") assert.NotSame(t, given.Ext, result.Ext, "ext") }) t.Run("assumptions", func(t *testing.T) { assert.ElementsMatch(t, discoverPointerFields(reflect.TypeOf(openrtb2.Geo{})), []string{ + "Lat", + "Lon", "Ext", }) }) @@ -1129,14 +1131,14 @@ func TestCloneDOOH(t *testing.T) { func TestCloneBidderReq(t *testing.T) { t.Run("nil", func(t *testing.T) { - result := CloneBidderReq(nil) + result := CloneBidRequestPartial(nil) assert.Nil(t, result) }) t.Run("empty", func(t *testing.T) { given := &openrtb2.BidRequest{} - result := CloneBidderReq(given) - assert.Equal(t, given, result.BidRequest) + result := CloneBidRequestPartial(given) + assert.Equal(t, given, result) assert.NotSame(t, given, result) }) @@ -1147,36 +1149,15 @@ func TestCloneBidderReq(t *testing.T) { Device: &openrtb2.Device{Carrier: "testCarrier"}, Source: &openrtb2.Source{TID: "testTID"}, } - result := CloneBidderReq(given) - assert.Equal(t, given, result.BidRequest) - assert.NotSame(t, given, result.BidRequest, "pointer") - assert.NotSame(t, given.User, result.User, "user") + result := CloneBidRequestPartial(given) + assert.Equal(t, given, result) + assert.NotSame(t, given, result, "pointer") assert.NotSame(t, given.Device, result.Device, "device") + assert.NotSame(t, given.User, result.User, "user") assert.NotSame(t, given.Source, result.Source, "source") }) - t.Run("assumptions", func(t *testing.T) { - assert.ElementsMatch(t, discoverPointerFields(reflect.TypeOf(openrtb2.BidRequest{})), - []string{ - "Device", - "User", - "Source", - "Imp", - "Site", - "App", - "DOOH", - "WSeat", - "BSeat", - "Cur", - "WLang", - "WLangB", - "BCat", - "BAdv", - "BApp", - "Regs", - "Ext", - }) - }) + // TODO: Implement a full bid request clone and track changes using an 'assumptions' test. } // discoverPointerFields returns the names of all fields of an object that are diff --git a/ortb/default_test.go b/ortb/default_test.go index 2d99da4bec2..7017f5f2114 100644 --- a/ortb/default_test.go +++ b/ortb/default_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/privacy/ccpa/consentwriter.go b/privacy/ccpa/consentwriter.go index 339eb3438fb..265d47e8595 100644 --- a/privacy/ccpa/consentwriter.go +++ b/privacy/ccpa/consentwriter.go @@ -1,7 +1,7 @@ package ccpa import ( - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" ) diff --git a/privacy/ccpa/consentwriter_test.go b/privacy/ccpa/consentwriter_test.go index e8414a8e2f5..a92400dce53 100644 --- a/privacy/ccpa/consentwriter_test.go +++ b/privacy/ccpa/consentwriter_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/privacy/ccpa/policy.go b/privacy/ccpa/policy.go index e5412b7d4c7..0b719bf1455 100644 --- a/privacy/ccpa/policy.go +++ b/privacy/ccpa/policy.go @@ -6,7 +6,7 @@ import ( gpplib "github.com/prebid/go-gpp" gppConstants "github.com/prebid/go-gpp/constants" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" gppPolicy "github.com/prebid/prebid-server/v2/privacy/gpp" diff --git a/privacy/ccpa/policy_test.go b/privacy/ccpa/policy_test.go index e18820b221b..0ea2b8cdf99 100644 --- a/privacy/ccpa/policy_test.go +++ b/privacy/ccpa/policy_test.go @@ -7,7 +7,7 @@ import ( gpplib "github.com/prebid/go-gpp" gppConstants "github.com/prebid/go-gpp/constants" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/privacy/gdpr/consentwriter.go b/privacy/gdpr/consentwriter.go index 25bc2bf0ca0..243a6cf79e9 100644 --- a/privacy/gdpr/consentwriter.go +++ b/privacy/gdpr/consentwriter.go @@ -1,7 +1,7 @@ package gdpr import ( - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" ) diff --git a/privacy/gdpr/consentwriter_test.go b/privacy/gdpr/consentwriter_test.go index d90de4a2405..47f24bc9ecc 100644 --- a/privacy/gdpr/consentwriter_test.go +++ b/privacy/gdpr/consentwriter_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/privacy/lmt/ios.go b/privacy/lmt/ios.go index ee08225f8c7..b7cb836cfe4 100644 --- a/privacy/lmt/ios.go +++ b/privacy/lmt/ios.go @@ -3,7 +3,7 @@ package lmt import ( "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/iosutil" ) diff --git a/privacy/lmt/ios_test.go b/privacy/lmt/ios_test.go index 7afaf7843e1..83b59b287fd 100644 --- a/privacy/lmt/ios_test.go +++ b/privacy/lmt/ios_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/util/iosutil" "github.com/stretchr/testify/assert" ) diff --git a/privacy/lmt/policy.go b/privacy/lmt/policy.go index 0272a4f96b9..b4ab10394fc 100644 --- a/privacy/lmt/policy.go +++ b/privacy/lmt/policy.go @@ -1,6 +1,6 @@ package lmt -import "github.com/prebid/openrtb/v19/openrtb2" +import "github.com/prebid/openrtb/v20/openrtb2" const ( trackingUnrestricted = 0 diff --git a/privacy/lmt/policy_test.go b/privacy/lmt/policy_test.go index 222f7aca0d1..29e9370b8c1 100644 --- a/privacy/lmt/policy_test.go +++ b/privacy/lmt/policy_test.go @@ -3,7 +3,7 @@ package lmt import ( "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/privacy/rule_condition_test.go b/privacy/rule_condition_test.go index 23973bd06d0..a0b3f855951 100644 --- a/privacy/rule_condition_test.go +++ b/privacy/rule_condition_test.go @@ -3,7 +3,7 @@ package privacy import ( "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/privacy/scrubber.go b/privacy/scrubber.go index ba1f8a9478b..7a67737f028 100644 --- a/privacy/scrubber.go +++ b/privacy/scrubber.go @@ -2,10 +2,11 @@ package privacy import ( "encoding/json" - "github.com/prebid/prebid-server/v2/util/jsonutil" "net" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/prebid-server/v2/util/jsonutil" + + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/iputil" @@ -160,8 +161,19 @@ func scrubGeoPrecision(geo *openrtb2.Geo) *openrtb2.Geo { } geoCopy := *geo - geoCopy.Lat = float64(int(geo.Lat*100.0+0.5)) / 100.0 // Round Latitude - geoCopy.Lon = float64(int(geo.Lon*100.0+0.5)) / 100.0 // Round Longitude + + if geoCopy.Lat != nil { + lat := *geo.Lat + lat = float64(int(lat*100.0+0.5)) / 100.0 + geoCopy.Lat = &lat + } + + if geoCopy.Lon != nil { + lon := *geo.Lon + lon = float64(int(lon*100.0+0.5)) / 100.0 + geoCopy.Lon = &lon + } + return &geoCopy } diff --git a/privacy/scrubber_test.go b/privacy/scrubber_test.go index 1fb88874d43..d06e0c9842e 100644 --- a/privacy/scrubber_test.go +++ b/privacy/scrubber_test.go @@ -4,8 +4,9 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/ptrutil" "github.com/stretchr/testify/assert" ) @@ -244,13 +245,13 @@ func TestScrubGEO(t *testing.T) { name: "nil_user_geo", userIn: &openrtb2.User{ID: "ID", Geo: nil}, expectedUser: &openrtb2.User{ID: "ID", Geo: nil}, - deviceIn: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: 123.123}}, - expectedDevice: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: 123.12}}, + deviceIn: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.123)}}, + expectedDevice: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.12)}}, }, { name: "with_user_geo", - userIn: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: 123.123}}, - expectedUser: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: 123.12}}, + userIn: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.123)}}, + expectedUser: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.12)}}, deviceIn: &openrtb2.Device{}, expectedDevice: &openrtb2.Device{}, }, @@ -265,15 +266,15 @@ func TestScrubGEO(t *testing.T) { name: "with_device_geo", userIn: &openrtb2.User{}, expectedUser: &openrtb2.User{}, - deviceIn: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: 123.123}}, - expectedDevice: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: 123.12}}, + deviceIn: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.123)}}, + expectedDevice: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.12)}}, }, { name: "with_user_and_device_geo", - userIn: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: 123.123}}, - expectedUser: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: 123.12}}, - deviceIn: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: 123.123}}, - expectedDevice: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: 123.12}}, + userIn: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.123)}}, + expectedUser: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.12)}}, + deviceIn: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.123)}}, + expectedDevice: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.12)}}, }, } for _, test := range testCases { @@ -311,7 +312,7 @@ func TestScrubGeoFull(t *testing.T) { }, { name: "with_user_geo", - userIn: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: 123.123}}, + userIn: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.123)}}, expectedUser: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{}}, deviceIn: &openrtb2.Device{}, expectedDevice: &openrtb2.Device{}, @@ -327,14 +328,14 @@ func TestScrubGeoFull(t *testing.T) { name: "with_device_geo", userIn: &openrtb2.User{}, expectedUser: &openrtb2.User{}, - deviceIn: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: 123.123}}, + deviceIn: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.123)}}, expectedDevice: &openrtb2.Device{Geo: &openrtb2.Geo{}}, }, { name: "with_user_and_device_geo", - userIn: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: 123.123}}, + userIn: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.123)}}, expectedUser: &openrtb2.User{ID: "ID", Geo: &openrtb2.Geo{}}, - deviceIn: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: 123.123}}, + deviceIn: &openrtb2.Device{Geo: &openrtb2.Geo{Lat: ptrutil.ToPtr(123.123)}}, expectedDevice: &openrtb2.Device{Geo: &openrtb2.Geo{}}, }, } @@ -416,15 +417,15 @@ func TestScrubIP(t *testing.T) { func TestScrubGeoPrecision(t *testing.T) { geo := &openrtb2.Geo{ - Lat: 123.456, - Lon: 678.89, + Lat: ptrutil.ToPtr(123.456), + Lon: ptrutil.ToPtr(678.89), Metro: "some metro", City: "some city", ZIP: "some zip", } geoExpected := &openrtb2.Geo{ - Lat: 123.46, - Lon: 678.89, + Lat: ptrutil.ToPtr(123.46), + Lon: ptrutil.ToPtr(678.89), Metro: "some metro", City: "some city", ZIP: "some zip", diff --git a/privacy/writer.go b/privacy/writer.go index 88b7c6ee5d6..1f4a13cd6a4 100644 --- a/privacy/writer.go +++ b/privacy/writer.go @@ -1,6 +1,6 @@ package privacy -import "github.com/prebid/openrtb/v19/openrtb2" +import "github.com/prebid/openrtb/v20/openrtb2" // PolicyWriter mutates an OpenRTB bid request with a policy's regulatory information. type PolicyWriter interface { diff --git a/privacy/writer_test.go b/privacy/writer_test.go index 1ee94abaf22..47b4365d6c0 100644 --- a/privacy/writer_test.go +++ b/privacy/writer_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/schain/schain.go b/schain/schain.go index a4139a93f5e..088e5a6099f 100644 --- a/schain/schain.go +++ b/schain/schain.go @@ -3,7 +3,7 @@ package schain import ( "fmt" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" ) diff --git a/schain/schain_test.go b/schain/schain_test.go index 310608420d9..e35396bf2bd 100644 --- a/schain/schain_test.go +++ b/schain/schain_test.go @@ -3,7 +3,7 @@ package schain import ( "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/schain/schainwriter.go b/schain/schainwriter.go index 0873e14f199..b7ff0b52e95 100644 --- a/schain/schainwriter.go +++ b/schain/schainwriter.go @@ -1,7 +1,7 @@ package schain import ( - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/jsonutil" ) diff --git a/schain/schainwriter_test.go b/schain/schainwriter_test.go index 26777306fdf..d9b1358ffe6 100644 --- a/schain/schainwriter_test.go +++ b/schain/schainwriter_test.go @@ -4,9 +4,10 @@ import ( "encoding/json" "testing" - "github.com/prebid/openrtb/v19/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/jsonutil" + + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" ) @@ -77,7 +78,7 @@ func TestSChainWriter(t *testing.T) { giveRequest: openrtb2.BidRequest{ Ext: json.RawMessage(`{"prebid":{"schains":[{"bidders":["appnexus"],` + seller1SChain + `}]}}`), Source: &openrtb2.Source{ - FD: 1, + FD: openrtb2.Int8Ptr(1), TID: "tid data", PChain: "pchain data", Ext: json.RawMessage(`{` + seller2SChain + `}`), @@ -87,7 +88,7 @@ func TestSChainWriter(t *testing.T) { wantRequest: openrtb2.BidRequest{ Ext: json.RawMessage(`{"prebid":{"schains":[{"bidders":["appnexus"],` + seller1SChain + `}]}}`), Source: &openrtb2.Source{ - FD: 1, + FD: openrtb2.Int8Ptr(1), TID: "tid data", PChain: "pchain data", Ext: json.RawMessage(`{` + seller1SChain + `}`), diff --git a/stored_responses/stored_responses.go b/stored_responses/stored_responses.go index 802602904bc..04dc3decf5a 100644 --- a/stored_responses/stored_responses.go +++ b/stored_responses/stored_responses.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/stored_requests" ) diff --git a/stored_responses/stored_responses_test.go b/stored_responses/stored_responses_test.go index 196466b7323..49ce19d3414 100644 --- a/stored_responses/stored_responses_test.go +++ b/stored_responses/stored_responses_test.go @@ -6,7 +6,7 @@ import ( "errors" "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/util/ptrutil/ptrutil.go b/util/ptrutil/ptrutil.go index 90888f3eef8..27616a0a4b5 100644 --- a/util/ptrutil/ptrutil.go +++ b/util/ptrutil/ptrutil.go @@ -12,3 +12,12 @@ func Clone[T any](v *T) *T { clone := *v return &clone } + +func ValueOrDefault[T any](v *T) T { + if v != nil { + return *v + } + + var def T + return def +} diff --git a/util/ptrutil/ptrutil_test.go b/util/ptrutil/ptrutil_test.go new file mode 100644 index 00000000000..85671e31b44 --- /dev/null +++ b/util/ptrutil/ptrutil_test.go @@ -0,0 +1,45 @@ +package ptrutil + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestValueOrDefault(t *testing.T) { + t.Run("int-nil", func(t *testing.T) { + var v *int = nil + r := ValueOrDefault(v) + assert.Equal(t, 0, r) + }) + + t.Run("int-0", func(t *testing.T) { + var v *int = ToPtr[int](0) + r := ValueOrDefault(v) + assert.Equal(t, 0, r) + }) + + t.Run("int-42", func(t *testing.T) { + var v *int = ToPtr[int](42) + r := ValueOrDefault(v) + assert.Equal(t, 42, r) + }) + + t.Run("string-nil", func(t *testing.T) { + var v *string = nil + r := ValueOrDefault(v) + assert.Equal(t, "", r) + }) + + t.Run("string-empty", func(t *testing.T) { + var v *string = ToPtr[string]("") + r := ValueOrDefault(v) + assert.Equal(t, "", r) + }) + + t.Run("string-something", func(t *testing.T) { + var v *string = ToPtr[string]("something") + r := ValueOrDefault(v) + assert.Equal(t, "something", r) + }) +} diff --git a/version/xprebidheader.go b/version/xprebidheader.go index 613a76d80b6..cb4ba2ec984 100644 --- a/version/xprebidheader.go +++ b/version/xprebidheader.go @@ -3,7 +3,7 @@ package version import ( "strings" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/openrtb_ext" ) diff --git a/version/xprebidheader_test.go b/version/xprebidheader_test.go index db31ea63620..712940e80bd 100644 --- a/version/xprebidheader_test.go +++ b/version/xprebidheader_test.go @@ -3,7 +3,7 @@ package version import ( "testing" - "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/openrtb/v20/openrtb2" "github.com/stretchr/testify/assert" "github.com/prebid/prebid-server/v2/openrtb_ext"