Skip to content

Commit

Permalink
add some supplemental
Browse files Browse the repository at this point in the history
  • Loading branch information
sambaiz committed Apr 24, 2020
1 parent 421e681 commit 9d46e33
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 69 deletions.
8 changes: 6 additions & 2 deletions adapters/aja/aja.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type AJAAdapter struct {

func (a *AJAAdapter) MakeRequests(bidReq *openrtb.BidRequest, extraInfo *adapters.ExtraRequestInfo) (adapterReqs []*adapters.RequestData, errs []error) {
// split imps by tagid
tagIDs := []string{}
impsByTagID := map[string][]openrtb.Imp{}
for _, imp := range bidReq.Imp {
extAJA, err := parseExtAJA(imp)
Expand All @@ -25,12 +26,15 @@ func (a *AJAAdapter) MakeRequests(bidReq *openrtb.BidRequest, extraInfo *adapter
}
imp.TagID = extAJA.AdSpotID
imp.Ext = nil
if _, ok := impsByTagID[imp.TagID]; !ok {
tagIDs = append(tagIDs, imp.TagID)
}
impsByTagID[imp.TagID] = append(impsByTagID[imp.TagID], imp)
}

req := *bidReq
for _, imps := range impsByTagID {
req.Imp = imps
for _, tagID := range tagIDs {
req.Imp = impsByTagID[tagID]
body, err := json.Marshal(req)
if err != nil {
errs = append(errs, err)
Expand Down
36 changes: 36 additions & 0 deletions adapters/aja/ajatest/supplemental/invalid-ext-bidder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"mockBidRequest": {
"id": "test-req-id",
"imp": [
{
"id": "test-imp-id",
"video": {
"mimes": ["video/mp4"],
"w": 640,
"h": 480
},
"ext": {
"bidder": {
"asi": 111
}
}
}
],
"user": {
"buyeruid": "test-uid"
},
"tmax": 500
},

"httpCalls": [],

"expectedBidResponses": [],

"expectedMakeRequestsErrors": [
{
"value": "Failed to unmarshal ext.bidder impID: test-imp-id err: json: cannot unmarshal number into Go struct field ExtImpAJA.asi of type string",
"comparison": "literal"
}

]
}
34 changes: 34 additions & 0 deletions adapters/aja/ajatest/supplemental/invalid-ext.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"mockBidRequest": {
"id": "test-req-id",
"imp": [
{
"id": "test-imp-id",
"video": {
"mimes": ["video/mp4"],
"w": 640,
"h": 480
},
"ext": {
"bidder": 111
}
}
],
"user": {
"buyeruid": "test-uid"
},
"tmax": 500
},

"httpCalls": [],

"expectedBidResponses": [],

"expectedMakeRequestsErrors": [
{
"value": "Failed to unmarshal ext.bidder impID: test-imp-id err: json: cannot unmarshal number into Go value of type openrtb_ext.ExtImpAJA",
"comparison": "literal"
}

]
}
15 changes: 2 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,17 @@ require (
github.com/DATA-DOG/go-sqlmock v1.3.0
github.com/NYTimes/gziphandler v1.1.1
github.com/OneOfOne/xxhash v1.2.5 // indirect
github.com/aerospike/aerospike-client-go v2.7.2+incompatible
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
github.com/blang/semver v3.5.1+incompatible
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b
github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44
github.com/cespare/xxhash v1.0.0 // indirect
github.com/chasex/glog v0.0.0-20160217080310-c62392af379c
github.com/coocood/freecache v1.0.1
github.com/didip/tollbooth v4.0.2+incompatible
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5
github.com/evanphx/json-patch v0.0.0-20180720181644-f195058310bd
github.com/go-redis/redis v6.15.7+incompatible
github.com/gocql/gocql v0.0.0-20200203083758-81b8263d9fe5
github.com/gofrs/uuid v3.2.0+incompatible
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/snappy v0.0.1
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/influxdata/influxdb v1.6.1 // indirect
github.com/julienschmidt/httprouter v1.1.0
Expand All @@ -37,38 +31,33 @@ require (
github.com/mxmCherry/openrtb v11.0.0+incompatible
github.com/onsi/ginkgo v1.10.1 // indirect
github.com/onsi/gomega v1.7.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/prebid/go-gdpr v0.7.0
github.com/prebid/prebid-cache v0.0.0-20200218152159-6d6d678c1caf
github.com/prometheus/client_golang v0.0.0-20180623155954-77e8f2ddcfed
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e // indirect
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273 // indirect
github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165
github.com/rs/cors v1.5.0
github.com/sergi/go-diff v1.0.0 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.1.1 // indirect
github.com/spf13/cast v1.2.0 // indirect
github.com/spf13/jwalterweatherman v0.0.0-20180814060501-14d3d4c51834 // indirect
github.com/spf13/pflag v1.0.2 // indirect
github.com/spf13/viper v1.1.0
github.com/stretchr/objx v0.1.1 // indirect
github.com/stretchr/testify v1.3.0
github.com/valyala/fasthttp v1.9.0
github.com/vrischmann/go-metrics-influxdb v0.0.0-20160917065939-43af8332c303
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v0.0.0-20180816142147-da425ebb7609
github.com/xorcare/pointer v1.1.0
github.com/yudai/gojsondiff v0.0.0-20170107030110-7b1b7adf999d
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
github.com/yudai/pp v2.0.1+incompatible // indirect
github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb // indirect
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 // indirect
golang.org/x/text v0.3.0
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
gopkg.in/yaml.v2 v2.2.1
)
Loading

0 comments on commit 9d46e33

Please sign in to comment.