diff --git a/adapters/adapterstest/test_json.go b/adapters/adapterstest/test_json.go index feb866e6b83..9ae5d795a43 100644 --- a/adapters/adapterstest/test_json.go +++ b/adapters/adapterstest/test_json.go @@ -162,8 +162,6 @@ func getTestExtraRequestInfo(t *testing.T, filename string, spec *testSpec, isAm } else if isVideoTest { reqInfo.PbsEntryPoint = "video" } - reqInfo = updateRequestInfoForOW(reqInfo, filename) // OW specific : required for oRTB bidder - return &reqInfo } diff --git a/adapters/adapterstest/test_json_ow.go b/adapters/adapterstest/test_json_ow.go deleted file mode 100644 index cd4790ce13e..00000000000 --- a/adapters/adapterstest/test_json_ow.go +++ /dev/null @@ -1,20 +0,0 @@ -package adapterstest - -import ( - "strings" - - "github.com/prebid/prebid-server/adapters" - "github.com/prebid/prebid-server/openrtb_ext" -) - -// updateRequestInfoForOW updates the reqInfo as per OW requirement -func updateRequestInfoForOW(reqInfo adapters.ExtraRequestInfo, fileName string) adapters.ExtraRequestInfo { - // for oRTB bidders (having prefix as 'ortb_', set the bidderName from file) - if strings.HasPrefix(fileName, "ortb_") { - files := strings.Split(fileName, "/") - if len(files) > 0 { - reqInfo.BidderCoreName = openrtb_ext.BidderName(files[0]) - } - } - return reqInfo -} diff --git a/adapters/ortbbidder/ortbbidder.go b/adapters/ortbbidder/ortbbidder.go index 1c9eee79729..95dddac0825 100644 --- a/adapters/ortbbidder/ortbbidder.go +++ b/adapters/ortbbidder/ortbbidder.go @@ -23,9 +23,9 @@ const ( // adapterInfo contains oRTB bidder specific info required in MakeRequests/MakeBids functions type adapterInfo struct { config.Adapter - requestMode string + extraInfo extraAdapterInfo } -type ExtraAdapterInfo struct { +type extraAdapterInfo struct { RequestMode string `json:"requestMode"` } @@ -47,7 +47,7 @@ func (o adapterInfo) prepareRequestData(request *openrtb2.BidRequest) (*adapters // Builder returns an instance of oRTB adapter func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { - extraAdapterInfo := ExtraAdapterInfo{} + extraAdapterInfo := extraAdapterInfo{} if len(config.ExtraAdapterInfo) > 0 { err := json.Unmarshal([]byte(config.ExtraAdapterInfo), &extraAdapterInfo) if err != nil { @@ -55,7 +55,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co } } return &adapter{ - adapterInfo: adapterInfo{config, extraAdapterInfo.RequestMode}, + adapterInfo: adapterInfo{config, extraAdapterInfo}, }, nil } @@ -67,7 +67,7 @@ func (o *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte var errs []error adapterInfo := o.adapterInfo // bidder request supports single impression in single HTTP call. - if adapterInfo.requestMode == RequestModeSingle { + if adapterInfo.extraInfo.RequestMode == RequestModeSingle { requestData := make([]*adapters.RequestData, 0, len(request.Imp)) requestCopy := *request for _, imp := range request.Imp { @@ -107,7 +107,6 @@ func (o *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R bidResponse := adapters.BidderResponse{ Bids: make([]*adapters.TypedBid, 0), } - var errs []error for _, seatBid := range response.SeatBid { for bidInd, bid := range seatBid.Bid { bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ @@ -116,7 +115,7 @@ func (o *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R }) } } - return &bidResponse, errs + return &bidResponse, nil } // getMediaTypeForBid returns the BidType as per the bid.MType field diff --git a/adapters/ortbbidder/ortbbidder_test.go b/adapters/ortbbidder/ortbbidder_test.go index 03292798112..6943f6815f1 100644 --- a/adapters/ortbbidder/ortbbidder_test.go +++ b/adapters/ortbbidder/ortbbidder_test.go @@ -57,7 +57,7 @@ func TestMakeRequests(t *testing.T) { requestInfo: &adapters.ExtraRequestInfo{ BidderCoreName: openrtb_ext.BidderName("ortb_test_multi_requestmode"), }, - adapterInfo: adapterInfo{config.Adapter{Endpoint: "http://test_bidder.com"}, ""}, + adapterInfo: adapterInfo{config.Adapter{Endpoint: "http://test_bidder.com"}, extraAdapterInfo{RequestMode: ""}}, }, want: want{ requestData: []*adapters.RequestData{ @@ -82,7 +82,7 @@ func TestMakeRequests(t *testing.T) { requestInfo: &adapters.ExtraRequestInfo{ BidderCoreName: openrtb_ext.BidderName("ortb_test_single_requestmode"), }, - adapterInfo: adapterInfo{config.Adapter{Endpoint: "http://test_bidder.com"}, "single"}, + adapterInfo: adapterInfo{config.Adapter{Endpoint: "http://test_bidder.com"}, extraAdapterInfo{RequestMode: "single"}}, }, want: want{ requestData: []*adapters.RequestData{ @@ -293,7 +293,7 @@ func TestGetMediaTypeForBid(t *testing.T) { } func TestJsonSamplesForSingleRequestMode(t *testing.T) { - bidder, buildErr := Builder("ortb_test_single_requestmode", + bidder, buildErr := Builder("owgeneric_single_requestmode", config.Adapter{ Endpoint: "http://test_bidder.com", ExtraAdapterInfo: `{"requestMode":"single"}`, @@ -301,11 +301,11 @@ func TestJsonSamplesForSingleRequestMode(t *testing.T) { if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) } - adapterstest.RunJSONBidderTest(t, "ortb_test_single_requestmode", bidder) + adapterstest.RunJSONBidderTest(t, "ortbbiddertest/owortb_generic_single_requestmode", bidder) } func TestJsonSamplesForMultiRequestMode(t *testing.T) { - bidder, buildErr := Builder("ortb_test_multi_requestmode", + bidder, buildErr := Builder("owgeneric_multi_requestmode", config.Adapter{ Endpoint: "http://test_bidder.com", ExtraAdapterInfo: ``, @@ -313,13 +313,12 @@ func TestJsonSamplesForMultiRequestMode(t *testing.T) { if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) } - adapterstest.RunJSONBidderTest(t, "ortb_test_multi_requestmode", bidder) + adapterstest.RunJSONBidderTest(t, "ortbbiddertest/owortb_generic_multi_requestmode", bidder) } func Test_oRTBAdapterInfo_prepareRequestData(t *testing.T) { type fields struct { - Adapter config.Adapter - requestMode string + Adapter config.Adapter } type args struct { request *openrtb2.BidRequest @@ -371,8 +370,7 @@ func Test_oRTBAdapterInfo_prepareRequestData(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { o := adapterInfo{ - Adapter: tt.fields.Adapter, - requestMode: tt.fields.requestMode, + Adapter: tt.fields.Adapter, } got, err := o.prepareRequestData(tt.args.request) assert.Equal(t, tt.want.requestData, got, "mismatched requestData") @@ -422,7 +420,9 @@ func TestBuilder(t *testing.T) { want: want{ bidder: &adapter{ adapterInfo: adapterInfo{ - requestMode: "single", + extraInfo: extraAdapterInfo{ + RequestMode: "single", + }, Adapter: config.Adapter{ ExtraAdapterInfo: `{"requestMode":"single"}`, }, diff --git a/adapters/ortbbidder/ortb_test_multi_requestmode/exemplary/multi_imps_video.json b/adapters/ortbbidder/ortbbiddertest/owortb_generic_multi_requestmode/exemplary/multi_imps_req.json similarity index 100% rename from adapters/ortbbidder/ortb_test_multi_requestmode/exemplary/multi_imps_video.json rename to adapters/ortbbidder/ortbbiddertest/owortb_generic_multi_requestmode/exemplary/multi_imps_req.json diff --git a/adapters/ortbbidder/ortb_test_single_requestmode/exemplary/multi_imps_video.json b/adapters/ortbbidder/ortbbiddertest/owortb_generic_single_requestmode/exemplary/multi_imps_req.json similarity index 100% rename from adapters/ortbbidder/ortb_test_single_requestmode/exemplary/multi_imps_video.json rename to adapters/ortbbidder/ortbbiddertest/owortb_generic_single_requestmode/exemplary/multi_imps_req.json diff --git a/go.mod b/go.mod index e477aeb6313..39fe027ff99 100644 --- a/go.mod +++ b/go.mod @@ -79,6 +79,7 @@ require ( github.com/subosito/gotenv v1.4.2 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + github.com/yudai/pp v2.0.1+incompatible // indirect golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect golang.org/x/sys v0.14.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect diff --git a/go.sum b/go.sum index 54d9cf92029..f2eb04cbe64 100644 --- a/go.sum +++ b/go.sum @@ -504,6 +504,7 @@ github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FB github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI= +github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/static/bidder-params/owortb_magnite.json b/static/bidder-params/owortb_magnite.json index af11cec587c..c175a7961f1 100644 --- a/static/bidder-params/owortb_magnite.json +++ b/static/bidder-params/owortb_magnite.json @@ -4,10 +4,10 @@ "description": "A schema which validates params accepted by the magnite (oRTB Integration) adapter", "type": "object", "properties": { - "bidder-param": { + "adunitID": { "type": "string", - "description": "Example of bidder-param" + "description": "adunitID param" } }, - "required": ["bidder-param"] + "required": ["adunitID"] }