Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaowl committed Nov 20, 2024
2 parents d3e248f + 63af8af commit d0983f9
Show file tree
Hide file tree
Showing 1,249 changed files with 11,289 additions and 6,871 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Go
"VARIANT": "1.20",
"VARIANT": "1.22",
// Options
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN go mod tidy
RUN go mod vendor
ARG TEST="true"
RUN if [ "$TEST" != "false" ]; then ./validate.sh ; fi
RUN go build -mod=vendor -ldflags "-X github.com/prebid/prebid-server/v2/version.Ver=`git describe --tags | sed 's/^v//'` -X github.com/prebid/prebid-server/v2/version.Rev=`git rev-parse HEAD`" .
RUN go build -mod=vendor -ldflags "-X github.com/prebid/prebid-server/v3/version.Ver=`git describe --tags | sed 's/^v//'` -X github.com/prebid/prebid-server/v3/version.Rev=`git rev-parse HEAD`" .

FROM ubuntu:20.04 AS release
LABEL maintainer="[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test: deps
ifeq "$(adapter)" ""
./validate.sh
else
go test github.com/prebid/prebid-server/v2/adapters/$(adapter) -bench=.
go test github.com/prebid/prebid-server/v3/adapters/$(adapter) -bench=.
endif

# build-modules generates modules/builder.go file which provides a list of all available modules
Expand Down
14 changes: 7 additions & 7 deletions account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (

"github.com/prebid/go-gdpr/consentconstants"

"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/stored_requests"
"github.com/prebid/prebid-server/v2/util/iputil"
"github.com/prebid/prebid-server/v2/util/jsonutil"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/metrics"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/stored_requests"
"github.com/prebid/prebid-server/v3/util/iputil"
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

// GetAccount looks up the config.Account object referenced by the given accountID, with access rules applied
Expand Down
14 changes: 7 additions & 7 deletions account/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"fmt"
"testing"

"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/stored_requests"
"github.com/prebid/prebid-server/v2/util/iputil"
"github.com/prebid/prebid-server/v2/util/ptrutil"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/metrics"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/stored_requests"
"github.com/prebid/prebid-server/v3/util/iputil"
"github.com/prebid/prebid-server/v3/util/ptrutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
21 changes: 11 additions & 10 deletions adapters/33across/33across.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (

"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/v3/adapters"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

type TtxAdapter struct {
Expand Down Expand Up @@ -76,7 +77,7 @@ func (a *TtxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapter
// Skip over imps whose extensions cannot be read since
// we cannot glean Prod or ZoneID which are required to
// group together. However let's not block request creation.
if err := json.Unmarshal(impCopy.Ext, &impExt); err == nil {
if err := jsonutil.Unmarshal(impCopy.Ext, &impExt); err == nil {
impKey := impExt.Ttx.Prod + impExt.Ttx.Zoneid
groupedImps[impKey] = append(groupedImps[impKey], impCopy)
} else {
Expand Down Expand Up @@ -126,14 +127,14 @@ func makeImps(imp openrtb2.Imp) (openrtb2.Imp, error) {
}

var bidderExt adapters.ExtImpBidder
if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil {
return openrtb2.Imp{}, &errortypes.BadInput{
Message: err.Error(),
}
}

var ttxExt openrtb_ext.ExtImp33across
if err := json.Unmarshal(bidderExt.Bidder, &ttxExt); err != nil {
if err := jsonutil.Unmarshal(bidderExt.Bidder, &ttxExt); err != nil {
return openrtb2.Imp{}, &errortypes.BadInput{
Message: err.Error(),
}
Expand Down Expand Up @@ -177,7 +178,7 @@ func makeReqExt(request *openrtb2.BidRequest) ([]byte, error) {
var reqExt reqExt

if len(request.Ext) > 0 {
if err := json.Unmarshal(request.Ext, &reqExt); err != nil {
if err := jsonutil.Unmarshal(request.Ext, &reqExt); err != nil {
return nil, err
}
}
Expand Down Expand Up @@ -215,7 +216,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequ

var bidResp openrtb2.BidResponse

if err := json.Unmarshal(response.Body, &bidResp); err != nil {
if err := jsonutil.Unmarshal(response.Body, &bidResp); err != nil {
return nil, []error{err}
}

Expand All @@ -226,7 +227,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequ
var bidExt bidExt
var bidType openrtb_ext.BidType

if err := json.Unmarshal(sb.Bid[i].Ext, &bidExt); err != nil {
if err := jsonutil.Unmarshal(sb.Bid[i].Ext, &bidExt); err != nil {
bidType = openrtb_ext.BidTypeBanner
} else {
bidType = getBidType(bidExt)
Expand Down
6 changes: 3 additions & 3 deletions adapters/33across/33across_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package ttx
import (
"testing"

"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/v3/adapters/adapterstest"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

func TestJsonSamples(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion adapters/33across/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

// This file actually intends to test static/bidder-params/33across.json
Expand Down
13 changes: 7 additions & 6 deletions adapters/aax/aax.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"net/url"

"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/v3/adapters"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

type adapter struct {
Expand Down Expand Up @@ -63,7 +64,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest

var bidResp openrtb2.BidResponse

if err := json.Unmarshal(response.Body, &bidResp); err != nil {
if err := jsonutil.Unmarshal(response.Body, &bidResp); err != nil {
return nil, []error{err}
}

Expand Down Expand Up @@ -96,7 +97,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co

func getMediaTypeForImp(bid openrtb2.Bid, imps []openrtb2.Imp) (openrtb_ext.BidType, error) {
var bidExt aaxResponseBidExt
err := json.Unmarshal(bid.Ext, &bidExt)
err := jsonutil.Unmarshal(bid.Ext, &bidExt)
if err == nil {
switch bidExt.AdCodeType {
case "banner":
Expand Down
6 changes: 3 additions & 3 deletions adapters/aax/aax_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (

"github.com/stretchr/testify/assert"

"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/v3/adapters/adapterstest"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

func TestJsonSamples(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion adapters/aax/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

// This file actually intends to test static/bidder-params/aax.json
Expand Down
17 changes: 9 additions & 8 deletions adapters/aceex/aceex.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"text/template"

"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/macros"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/adapters"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/macros"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

type adapter struct {
Expand Down Expand Up @@ -90,13 +91,13 @@ func (a *adapter) MakeRequests(

func (a *adapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtAceex, error) {
var bidderExt adapters.ExtImpBidder
if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil {
return nil, &errortypes.BadInput{
Message: "ext.bidder not provided",
}
}
var aceexExt openrtb_ext.ExtAceex
if err := json.Unmarshal(bidderExt.Bidder, &aceexExt); err != nil {
if err := jsonutil.Unmarshal(bidderExt.Bidder, &aceexExt); err != nil {
return nil, &errortypes.BadInput{
Message: "ext.bidder not provided",
}
Expand Down Expand Up @@ -151,7 +152,7 @@ func (a *adapter) MakeBids(

responseBody := bidderRawResponse.Body
var bidResp openrtb2.BidResponse
if err := json.Unmarshal(responseBody, &bidResp); err != nil {
if err := jsonutil.Unmarshal(responseBody, &bidResp); err != nil {
return nil, []error{&errortypes.BadServerResponse{
Message: "Bad Server Response",
}}
Expand Down
6 changes: 3 additions & 3 deletions adapters/aceex/aceex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package aceex
import (
"testing"

"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/v3/adapters/adapterstest"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion adapters/aceex/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

var validParams = []string{
Expand Down
17 changes: 9 additions & 8 deletions adapters/acuityads/acuityads.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"text/template"

"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/macros"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/adapters"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/errortypes"
"github.com/prebid/prebid-server/v3/macros"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

type AcuityAdsAdapter struct {
Expand Down Expand Up @@ -90,13 +91,13 @@ func (a *AcuityAdsAdapter) MakeRequests(

func (a *AcuityAdsAdapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtAcuityAds, error) {
var bidderExt adapters.ExtImpBidder
if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil {
return nil, &errortypes.BadInput{
Message: "ext.bidder not provided",
}
}
var acuityAdsExt openrtb_ext.ExtAcuityAds
if err := json.Unmarshal(bidderExt.Bidder, &acuityAdsExt); err != nil {
if err := jsonutil.Unmarshal(bidderExt.Bidder, &acuityAdsExt); err != nil {
return nil, &errortypes.BadInput{
Message: "ext.bidder not provided",
}
Expand Down Expand Up @@ -155,7 +156,7 @@ func (a *AcuityAdsAdapter) MakeBids(

responseBody := bidderRawResponse.Body
var bidResp openrtb2.BidResponse
if err := json.Unmarshal(responseBody, &bidResp); err != nil {
if err := jsonutil.Unmarshal(responseBody, &bidResp); err != nil {
return nil, []error{&errortypes.BadServerResponse{
Message: "Bad Server Response",
}}
Expand Down
6 changes: 3 additions & 3 deletions adapters/acuityads/acuityads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package acuityads
import (
"testing"

"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/v3/adapters/adapterstest"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion adapters/acuityads/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v3/openrtb_ext"
)

var validParams = []string{
Expand Down
11 changes: 8 additions & 3 deletions adapters/adapterstest/test_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import (
"os"
"path/filepath"
"regexp"
"strings"
"testing"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/mitchellh/copystructure"
"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"
"github.com/prebid/prebid-server/v3/adapters"
"github.com/prebid/prebid-server/v3/currency"
"github.com/prebid/prebid-server/v3/openrtb_ext"
"github.com/stretchr/testify/assert"
"github.com/yudai/gojsondiff"
"github.com/yudai/gojsondiff/formatter"
Expand Down Expand Up @@ -273,6 +274,10 @@ func assertErrorList(t *testing.T, description string, actual []error, expected
if matched, _ := regexp.MatchString(expected[i].Value, actual[i].Error()); !matched {
t.Errorf(`%s error[%d] had wrong message. Expected match with regex "%s", got "%s"`, description, i, expected[i].Value, actual[i].Error())
}
} else if expected[i].Comparison == "startswith" {
if !strings.HasPrefix(actual[i].Error(), expected[i].Value) {
t.Errorf(`%s error[%d] had wrong message. Expected to start with "%s", got "%s"`, description, i, expected[i].Value, actual[i].Error())
}
} else {
t.Fatalf(`invalid comparison type "%s"`, expected[i].Comparison)
}
Expand Down
Loading

0 comments on commit d0983f9

Please sign in to comment.